http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90898

Revision: 90898
Author:   ariel
Date:     2011-06-27 19:14:43 +0000 (Mon, 27 Jun 2011)
Log Message:
-----------
change to return nonzero on failure and 0 on success

Modified Paths:
--------------
    branches/ariel/xmldumps-backup/checkforbz2footer.c
    branches/ariel/xmldumps-backup/checkfortruncatedbz2s.sh

Modified: branches/ariel/xmldumps-backup/checkforbz2footer.c
===================================================================
--- branches/ariel/xmldumps-backup/checkforbz2footer.c  2011-06-27 18:39:28 UTC 
(rev 90897)
+++ branches/ariel/xmldumps-backup/checkforbz2footer.c  2011-06-27 19:14:43 UTC 
(rev 90898)
@@ -17,8 +17,8 @@
    Arguments: the name of the file to check, presumably 
    a bzipped file. 
    Outputs: none.
-   Exits with 1 if the file contains the footer at the end, 
-   0 if the file does not contain the footer, and -1 on error.
+   Exits with 0 if the file contains the footer at the end, 
+   1 if the file does not contain the footer, and -1 on error.
 */
 
 
@@ -74,26 +74,26 @@
   if (bitsrightshifted == 0) {
     for (i = 0; i< numbytes; i++) {
       if (buff1[i] != buff2[i]) {
-       return(0);
+       return(1);
       }
     }
-    return(1);
+    return(0);
   }
   else {
     for (i = 1; i< numbytes-2; i++) {
       if (buff1[i] != buff2[i]) {
-       return(0);
+       return(1);
       }
     }
     /* do leftmost byte */
     if ((buff1[0] & bitmask(8-bitsrightshifted,RIGHT))  != (buff2[0] & 
bitmask(8-bitsrightshifted,RIGHT)) ) {
-      return(0);
+      return(1);
     }
     /* do rightmost byte */
     if ((buff1[numbytes-1] & bitmask(bitsrightshifted,LEFT))  != 
(buff2[numbytes-1] & bitmask(bitsrightshifted,LEFT)) ) {
-      return(0);
+      return(1);
     }
-    return(1);
+    return(0);
   }
 }
 
@@ -122,17 +122,17 @@
   read_footer(buffer,fin);
 
   result = bytescompare(footer[0],buffer+1,6,0);
-  if (result) {
-    return(result);
+  if (!result) {
+    return(0);
   }
   
   for (i=1; i<8; i++) {
     result = bytescompare(footer[i],buffer,7,i);
-    if (result) {
-      return(result);
+    if (!result) {
+      return(0);
     }
   }
-  return(0);
+  return(1);
 }
 
 int main(int argc, char **argv) {

Modified: branches/ariel/xmldumps-backup/checkfortruncatedbz2s.sh
===================================================================
--- branches/ariel/xmldumps-backup/checkfortruncatedbz2s.sh     2011-06-27 
18:39:28 UTC (rev 90897)
+++ branches/ariel/xmldumps-backup/checkfortruncatedbz2s.sh     2011-06-27 
19:14:43 UTC (rev 90898)
@@ -1,3 +1,3 @@
 #!/bin/bash
 rm -f /backups-atg/truncated.files
-find /mnt/data/xmldatadumps/public -name \*bz2 -a -type f -exec sh -c 
'/backups-atg/checkforbz2footer {}; if [ $? -eq 0 ]; then echo {} >> 
/backups-atg/truncated.files; fi' \;
+find /mnt/data/xmldatadumps/public -name \*bz2 -a -type f -exec sh -c 
'/backups-atg/checkforbz2footer {}; if [ $? -ne 0 ]; then echo {} >> 
/backups-atg/truncated.files; fi' \;


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to