]> git.sur5r.net Git - bacula/bacula/blobdiff - bacula/src/lib/scan.c
Ignore UTF-8 marker at the start of .conf files.
[bacula/bacula] / bacula / src / lib / scan.c
index 3bdc3526fb1d6bb26f2d45b62c263dafc16721cc..5e9403fd54a5f59889bd99b52d8c319f8e6cb2d8 100644 (file)
@@ -49,6 +49,16 @@ void strip_trailing_junk(char *cmd)
       *p-- = 0;
 }
 
+/* Strip any trailing newline characters from the string */
+void strip_trailing_newline(char *cmd)
+{
+   char *p;
+   p = cmd + strlen(cmd) - 1;
+
+   while ((p >= cmd) && (*p == '\n' || *p == '\r'))
+      *p-- = 0;
+}
+
 /* Strip any trailing slashes from a directory path */
 void strip_trailing_slashes(char *dir)
 {
@@ -329,7 +339,9 @@ switch_top:
             }
             vp = (void *)va_arg(ap, void *);
 //          Dmsg2(000, "val=%lld at 0x%lx\n", value, (long unsigned)vp);
-            if (l < 2) {
+            if (l == 0) {
+               *((int *)vp) = (int)value;
+            } else if (l == 1) {
                *((uint32_t *)vp) = (uint32_t)value;
 //             Dmsg0(000, "Store 32 bit int\n");
             } else {
@@ -406,6 +418,7 @@ switch_top:
       } else if (*buf++ != *fmt++) {
 //       Dmsg2(000, "Mismatch buf=%c fmt=%c\n", *--buf, *--fmt);
          error = true;
+         break;
       }
    }
    va_end(ap);