]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix run_program return status
authorKern Sibbald <kern@sibbald.com>
Mon, 10 Feb 2003 21:35:47 +0000 (21:35 +0000)
committerKern Sibbald <kern@sibbald.com>
Mon, 10 Feb 2003 21:35:47 +0000 (21:35 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@341 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/kernstodo
bacula/src/lib/bpipe.c
bacula/src/stored/mount.c

index 5f8d1e5f32c711ae6d400e38280a0e30eca0a2c1..c87c9df56a505e96de0523c9b94c9fcc856b0e4a 100644 (file)
@@ -16,6 +16,9 @@ Testing to do: (painful)
 - multiple simultaneous Volumes
 
 For 1.30 release:
+- Change stat1= fgets()!=NULL to stat1=fgest()==NULL; in 
+  run_program -- bpipe.c
+- Add RunBeforeJob and RunAfterJob to the Client program.
 - Have SD compute MD5 or SHA1 and compare to what FD computes.
 - Make VolumeToCatalog calculate an MD5 or SHA1 from the 
   actual data on the Volume and compare it.                  
@@ -834,4 +837,3 @@ Done: (see kernsdone for more)
 - Implement multiple simultaneous file Volumes on a single device.
 - Cleanup db_update_media and db_update_pool
 - Flush all the daemon messages at the end of every job.
-
index 729d5e2a10e10f071da245d44b5299ea73ebe0bf..7b284c9ce9dce17587c5769a33cf1ec00fc55a8a 100644 (file)
@@ -197,6 +197,11 @@ int close_bpipe(BPIPE *bpipe)
  * Run an external program. Optionally wait a specified number
  *   of seconds. Program killed if wait exceeded. Optionally
  *   return the output from the program (normally a single line).
+ *
+ * Contrary to my normal calling conventions, this program 
+ *
+ *  Returns: 0 on success
+ *          non-zero on error
  */
 int run_program(char *prog, int wait, POOLMEM *results)
 {
@@ -211,12 +216,12 @@ int run_program(char *prog, int wait, POOLMEM *results)
    }
    if (results) {
       results[0] = 0;
-      stat1 = fgets(results, sizeof_pool_memory(results), bpipe->rfd) != NULL;
+      stat1 = fgets(results, sizeof_pool_memory(results), bpipe->rfd) == NULL;
    } else {
-      stat1 = 1;
+      stat1 = 0;
    }
    stat2 = close_bpipe(bpipe);
-   return stat1 && stat2;
+   return stat2 != 0 ? stat2 : stat1; 
 }
 
 
index ab69174604768a3db0a4da25b09dc0d28e6f987a..ebe6031cede301b006312c3ed97867d70cea6911 100644 (file)
@@ -420,6 +420,7 @@ int autoload_device(JCR *jcr, DEVICE *dev, int writing, BSOCK *dir)
       changer = edit_device_codes(jcr, changer, jcr->device->changer_command, 
                    "loaded");
       status = run_program(changer, timeout, results);
+      Dmsg3(100, "run_prog: %s stat=%d result=%s\n", changer, status, results);
       if (status == 0) {
         loaded = atoi(results);
       } else {