[prev in list] [next in list] [prev in thread] [next in thread]
List: ipcop-cvs
Subject: [IPCop-cvs] ipcop/src/misc-progs ipcopbackup.c,1.8.2.10,1.8.2.11
From: Gilles Espinasse <gespinasse () users ! sourceforge ! net>
Date: 2006-05-31 20:18:17
Message-ID: E1FlX91-00064Q-EA () mail ! sourceforge ! net
[Download RAW message or body]
Update of /cvsroot/ipcop/ipcop/src/misc-progs
In directory sc8-pr-cvs11.sourceforge.net:/tmp/cvs-serv22841/src/misc-progs
Modified Files:
Tag: IPCOP_v1_4_0
ipcopbackup.c
Log Message:
First fix the tar (remove CONFIG_ROOT after -T)
Secondly, fix the 'write protected' check
Return value of 'dd if=/dev/zero of=/dev/floppy' is always 1 as dd write
until floppy end is reached
So change the small read to a small write allow to detect protected floppy.
Third , all messages emitted in ipcopbackup with perror have
'Bad file descriptor' added at the end.
Replace with fprintf(stderr \n) solve the problem.
Index: ipcopbackup.c
===================================================================
RCS file: /cvsroot/ipcop/ipcop/src/misc-progs/ipcopbackup.c,v
retrieving revision 1.8.2.10
retrieving revision 1.8.2.11
diff -C2 -d -r1.8.2.10 -r1.8.2.11
*** ipcopbackup.c 29 May 2006 22:27:26 -0000 1.8.2.10
--- ipcopbackup.c 31 May 2006 20:18:15 -0000 1.8.2.11
***************
*** 77,81 ****
while ((count = read(systeminclude, buffer, STRING_SIZE))) {
if( write (tempfile, buffer, count) < 0 ) {
! perror( "temp file write failed" );
exit(1);
}
--- 77,81 ----
while ((count = read(systeminclude, buffer, STRING_SIZE))) {
if( write (tempfile, buffer, count) < 0 ) {
! fprintf(stderr, "temp file write failed\n" );
exit(1);
}
***************
*** 91,95 ****
while ((count = read(userinclude, buffer, STRING_SIZE))) {
if( write (tempfile, buffer, count) < 0 ) {
! perror( "temp file write failed" );
exit(1);
}
--- 91,95 ----
while ((count = read(userinclude, buffer, STRING_SIZE))) {
if( write (tempfile, buffer, count) < 0 ) {
! fprintf(stderr, "temp file write failed\n" );
exit(1);
}
***************
*** 102,109 ****
/* Darren Critchley - check for floppy disk in disk drive before continuing */
snprintf (command, STRING_SIZE-1,
! "dd if=/dev/floppy of=/dev/null bs=1k count=1 2> /dev/null");
if (safe_system(command)) {
! perror( "Error: No floppy in drive or bad floppy in drive" );
exit(1);
}
--- 102,110 ----
/* Darren Critchley - check for floppy disk in disk drive before continuing */
+ /* Test too write protected floppy */
snprintf (command, STRING_SIZE-1,
! "dd if=/dev/zero of=/dev/floppy bs=1k count=1 2> /dev/null");
if (safe_system(command)) {
! fprintf(stderr,"Error: Bad ,write protected or no floppy in drive\n" );
exit(1);
}
***************
*** 112,123 ****
snprintf (command, STRING_SIZE-1,
"/bin/dd if=/dev/zero of=/dev/floppy bs=1k 2> /dev/null");
! if (safe_system (command)) {
! perror( "Error: Floppy write protected or bad floppy in drive" );
! exit(1);
! }
/* Start tarring files to floppy */
snprintf (command, STRING_SIZE-1,
! "/bin/tar -T " CONFIG_ROOT " %s"
" -X " CONFIG_ROOT "/backup/exclude.system"
" -X " CONFIG_ROOT "/backup/exclude.user"
--- 113,121 ----
snprintf (command, STRING_SIZE-1,
"/bin/dd if=/dev/zero of=/dev/floppy bs=1k 2> /dev/null");
! safe_system (command);
/* Start tarring files to floppy */
snprintf (command, STRING_SIZE-1,
! "/bin/tar -T %s"
" -X " CONFIG_ROOT "/backup/exclude.system"
" -X " CONFIG_ROOT "/backup/exclude.user"
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
IPCop-cvs mailing list
IPCop-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ipcop-cvs
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic