]> git.sur5r.net Git - bacula/bacula/commitdiff
Fix conio.c on FreeBSD + fix string concat on FreeBSD
authorKern Sibbald <kern@sibbald.com>
Sun, 28 Dec 2003 14:32:58 +0000 (14:32 +0000)
committerKern Sibbald <kern@sibbald.com>
Sun, 28 Dec 2003 14:32:58 +0000 (14:32 +0000)
git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@961 91ce42f0-d328-0410-95d8-f526ca767f89

bacula/ChangeLog
bacula/ReleaseNotes
bacula/src/console/conio.c
bacula/src/dird/sql_cmds.c
bacula/src/lib/bnet.c
bacula/src/lib/bpipe.c
bacula/src/lib/message.c
bacula/src/version.h

index 08a8c16028fefec4bd3456473d9254353927feab..ab9da4c99f2b8f656fad6b12002a62726579e9b4 100644 (file)
@@ -1,5 +1,27 @@
 
 2003-12-xxx Version 1.33  xxNov03
+28Dec03
+- Find commonset of c_iflags that work with FreeBSD tcsetattr on terminals.
+- Remove comments from string concatenation -- doesn't work on FreeBSD
+  compiler.
+- Moderately improve bpipe_close() errors. Must rethink status return.
+- Eliminate some Emsgs in favor of Jmsgs.
+27Dec03
+- Add optional Pool keyword on restore command line. If specified, the pool
+  used will be restricted to the specified pool.
+- "Finish" implementation of JobDefs.
+- Fix directory for chmod of cats scripts.
+26Dec03
+- Implement foreach_res() #define and start replacing old code.
+- Work some more on jobdefs -- more to be done.
+- Implement bstrftime_nc() bstrftime with no century.
+- Fix static console problem in gnome2 and gnome directories reported by Alan 
+  Brown.
+- Add code to test for valid Resource Names. Permitted characters are now
+  alpha, numeric, colon, period, minus, underscore, space.
+- Turnoff some unused code in timers.c
+- Start adding code to dev.c to prevent infinite loops if fast forward space
+  file (MTFSF) is configured on but not properly supported by OS.
 24Nov03
 - Sort FileSet selection list by CreateTime.
 - Add "lsmark", and "estimate" to tree routines.
index 2f6d4165734816dc4868de419b256746016846d0..729c67e3d3733e5717cbff798b72840cb652e090 100644 (file)
@@ -1,7 +1,7 @@
 
           Release Notes for Bacula 1.33
 
-  Bacula code: Total files = 281 Total lines = 83,612 (*.h *.c *.in)
+  Bacula code: Total files = 281 Total lines = 83,815 (*.h *.c *.in)
 
 Most Significant Changes since 1.32d
 - Implement "update slots scan" that reads the volume label(s).
@@ -24,6 +24,7 @@ Most Significant Changes since 1.32d
   tape block, so the tape is not recognized.
 
 Other Changes since 1.32d
+- Implement conio.c to use in console program -- mini-readline.
 - Enhance "fill" command of btape -- simpler output. Use -v to
   cause last block to be dumped after write and after re-read.
 - Added an autochanger test to the btape "test" command. It is 
index 0bc02354a2800e47e64530244560ff05d79ca3ab..0e50af0334319a53d104042d6a9efd081d45c06d 100755 (executable)
@@ -9,6 +9,7 @@
 #else
 #include <stdio.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <signal.h>
 #include <string.h>
 #include <ctype.h> 
@@ -780,7 +781,7 @@ static void add_esc_smap(char *str, int func)
       return;
    }
    if (tcgetattr(0, &old_term_params) != 0) {
-      printf(_("conio: Cannot tcgetattr()\n"));
+      printf("conio: Cannot tcgetattr()\n");
       exit(1);
    }
    old_term_params_set = true;
@@ -789,8 +790,7 @@ static void add_esc_smap(char *str, int func)
    t.c_cc[VTIME] = 0;
    t.c_iflag &= ~(BRKINT | IGNPAR | PARMRK | INPCK | 
                  ISTRIP | ICRNL | IXON | IXOFF | INLCR | IGNCR);     
-   t.c_iflag |= IGNBRK | ISIG;
-// t.c_oflag &= ~(OPOST);    /* no output processing */       
+   t.c_iflag |= IGNBRK;
    t.c_oflag |= ONLCR;
    t.c_lflag &= ~(ECHO | ECHOE | ECHOK | ECHONL | ICANON |
                  NOFLSH | TOSTOP);
@@ -799,13 +799,13 @@ static void add_esc_smap(char *str, int func)
       printf("Cannot tcsetattr()\n");
    }
 
-// signal(SIGQUIT, SIG_IGN);
-// signal(SIGHUP, SIG_IGN);
+   signal(SIGQUIT, SIG_IGN);
+   signal(SIGHUP, SIG_IGN);
 // signal(SIGSTOP, SIG_IGN);
    signal(SIGINT, sigintcatcher);
-// signal(SIGWINCH, SIG_IGN);  
-// signal(SIGQUIT, SIG_IGN);
-// signal(SIGCHLD, SIG_IGN);
+   signal(SIGWINCH, SIG_IGN);  
+   signal(SIGQUIT, SIG_IGN);
+   signal(SIGCHLD, SIG_IGN);
 // signal(SIGTSTP, SIG_IGN);
 
    if (!termtype) {
@@ -894,10 +894,7 @@ static void add_esc_smap(char *str, int func)
 static int
 /*FCN*/t_gnc()
 {
-    int ch;
-
-    while ((ch=t_getch()) == 0) ;     /* get next input character */
-    return(ch);
+    return t_getch();
 }
 
 
@@ -1028,4 +1025,3 @@ static void asdell()
 {
    t_send(t_dl);
 }
-
index 048be2c52675cfd94c7b11d2d7571ec5e217ed76..d02a0b44dd663c786c1cb50bc88bd6ad3bb0f5e1 100644 (file)
@@ -231,7 +231,7 @@ char *uar_last_full =
    "AND JobMedia.MediaId=Media.MediaId "
    "AND Job.FileSetId=FileSet.FileSetId "
    "AND FileSet.FileSet='%s' "
-   "%s"                               /* dynamically added PoolId selection */
+   "%s"
    "ORDER BY Job.JobTDate DESC LIMIT 1";
 
 char *uar_full = 
@@ -254,7 +254,7 @@ char *uar_inc_dec =
    "AND JobMedia.MediaId=Media.MediaId "
    "AND Job.Level IN ('I', 'D') AND JobStatus='T' "
    "AND Job.FileSetId=FileSet.FileSetId "
-   "%s"                               /* dynamically added PoolId selection */
+   "%s"
    "AND FileSet.FileSet='%s' ";
 
 char *uar_list_temp = 
index 13485befa132c1d06570fe1af69cbba655d00a7e..69039eda49ffaf333ddaaa6624c4f31540e08673 100644 (file)
@@ -540,7 +540,7 @@ static uint32_t *bget_host_ip(JCR *jcr, char *host)
    } else {
       P(ip_mutex);
       if ((hp = gethostbyname(host)) == NULL) {
-         Jmsg2(jcr, M_ERROR, 0, "gethostbyname() for %s failed: ERR=%s\n", 
+         Jmsg2(jcr, M_ERROR, 0, "gethostbyname() for host \"%s\" failed: ERR=%s\n", 
               host, gethost_strerror());
         V(ip_mutex);
         return NULL;
index 1501e18d2c41fd4b8333e709ebaaf5591e2c69b7..b5bb3fa0bcf93fa2d624255d52cddb8e85b41b5f 100644 (file)
@@ -132,7 +132,12 @@ int close_wpipe(BPIPE *bpipe)
    return stat;
 }
 
-/* Close both pipes and free resources */
+/* 
+ * Close both pipes and free resources  
+ *
+ *  Returns: 0 on success
+ *          errno on failure
+ */
 int close_bpipe(BPIPE *bpipe) 
 {
    int chldstatus = 0;
@@ -176,8 +181,7 @@ int close_bpipe(BPIPE *bpipe)
         bmicrosleep(1, 0);            /* wait one second */
         remaining_wait--;
       } else {
-        stat = 1;                    /* set error status */
-        errno = ETIME;               /* set timed out */
+        stat = ETIME;                /* set error status */
         wpid = -1;
          break;                       /* don't wait any longer */
       }
@@ -185,14 +189,14 @@ int close_bpipe(BPIPE *bpipe)
    if (wpid > 0) {
       if (WIFEXITED(chldstatus)) {          /* process exit()ed */
         stat = WEXITSTATUS(chldstatus);
-          Dmsg1(200, "status =%d\n", stat);
+        if (stat != 0) {
+           stat = ECHILD;
+        }
+         Dmsg1(200, "status =%d\n", stat);
       } else if (WIFSIGNALED(chldstatus)) {  /* process died */
-        stat = 1;
+        stat = ECHILD;
          Dmsg0(200, "Signaled\n");
       }
-      if (stat != 0) {
-        errno = ECHILD;              /* set child errno */
-      }
    }  
    if (bpipe->timer_id) {
       stop_child_timer(bpipe->timer_id);
@@ -211,7 +215,7 @@ int close_bpipe(BPIPE *bpipe)
  * Contrary to my normal calling conventions, this program 
  *
  *  Returns: 0 on success
- *          non-zero on error
+ *          non-zero on error == errno
  */
 int run_program(char *prog, int wait, POOLMEM *results)
 {
@@ -222,7 +226,7 @@ int run_program(char *prog, int wait, POOLMEM *results)
    mode = (char *)(results != NULL ? "r" : "");
    bpipe = open_bpipe(prog, wait, mode);
    if (!bpipe) {
-      return 0;
+      return ENOENT;
    }
    if (results) {
       mp_chr(results)[0] = 0;
index ba4fce000f731c106e4781d88fa62cc2f1ce2d17..43367c9f3018a0412b49f04385b4b692dcf15cb8 100755 (executable)
@@ -477,8 +477,9 @@ void close_msg(JCR *jcr)
            stat = close_bpipe(bpipe);
            if (stat != 0 && msgs != daemon_msgs) {
                Dmsg1(150, "Calling emsg. CMD=%s\n", cmd);
-               Jmsg2(jcr, M_ERROR, 0, _("Mail program terminated in error. stat=%d\n"
-                                        "CMD=%s\n"), stat, cmd);
+               Jmsg3(jcr, M_ERROR, 0, _("Mail program terminated in error. stat=%d\n"
+                                        "CMD=%s\n"
+                                        "ERR=%s\n"), stat, cmd, strerror(stat));
            }
            free_memory(line);
 rem_temp_file:
@@ -636,8 +637,9 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg)
                   /* Messages to the operator go one at a time */
                   stat = close_bpipe(bpipe);
                   if (stat != 0) {
-                      Emsg1(M_ERROR, 0, _("Operator mail program terminated in error.\nCMD=%s\n"),
-                        mcmd);
+                      Jmsg2(jcr, M_ERROR, 0, _("Operator mail program terminated in error.\n"
+                            "CMD=%s\n"
+                            "ERR=%s\n"), mcmd, strerror(stat));
                   }
                }
                free_pool_memory(mcmd);
@@ -651,7 +653,7 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg)
                    d->fd = fopen(mp_chr(name), "w+");
                   if (!d->fd) {
                      d->fd = stdout;
-                      Emsg2(M_ERROR, 0, "fopen %s failed: ERR=%s\n", name, strerror(errno));
+                      Jmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", name, strerror(errno));
                      d->fd = NULL;
                      free_pool_memory(name);
                      break;
@@ -670,7 +672,7 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg)
                    d->fd = fopen(d->where, "w+");
                   if (!d->fd) {
                      d->fd = stdout;
-                      Emsg2(M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno));
+                      Jmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno));
                      d->fd = NULL;
                      break;
                   }
@@ -683,7 +685,7 @@ void dispatch_message(JCR *jcr, int type, int level, char *msg)
                    d->fd = fopen(d->where, "a");
                   if (!d->fd) {
                      d->fd = stdout;
-                      Emsg2(M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno));
+                      Jmsg2(jcr, M_ERROR, 0, "fopen %s failed: ERR=%s\n", d->where, strerror(errno));
                      d->fd = NULL;
                      break;
                   }
@@ -744,7 +746,7 @@ d_msg(char *file, int line, int level, char *fmt,...)
           bsnprintf(buf, sizeof(buf), "%s/bacula.trace", working_directory);
           trace_fd = fopen(buf, "a+");
          if (!trace_fd) {
-             Emsg2(M_ABORT, 0, _("Cannot open %s: ERR=%s\n"),
+             Emsg2(M_ABORT, 0, _("Cannot open trace file \"%s\": ERR=%s\n"),
                  buf, strerror(errno));
          }
        }
@@ -830,7 +832,7 @@ t_msg(char *file, int line, int level, char *fmt,...)
           bsnprintf(buf, sizeof(buf), "%s/bacula.trace", working_directory);
           trace_fd = fopen(buf, "a+");
          if (!trace_fd) {
-             Emsg2(M_ABORT, 0, _("Cannot open %s: ERR=%s\n"),
+             Emsg2(M_ABORT, 0, _("Cannot open trace file \"%s\": ERR=%s\n"),
                  buf, strerror(errno));
          }
        }
index 85b7b71757f8b3e5cbc7ab6dce1820c45e72a10e..07c1431581ac2922f042bf906656e632990f2640 100644 (file)
@@ -2,8 +2,8 @@
 #undef  VERSION
 #define VERSION "1.33"
 #define VSTRING "1"
-#define BDATE   "26 Dec 2003"
-#define LSMDATE "26Dec03"
+#define BDATE   "28 Dec 2003"
+#define LSMDATE "28Dec03"
 
 /* Debug flags */
 #undef  DEBUG