From: Kern Sibbald Date: Sun, 22 Feb 2004 17:41:19 +0000 (+0000) Subject: Fix compat.cpp times X-Git-Tag: Release-7.0.0~9687 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=74939a89bb25ff83b481176e92164d27488341e8;p=bacula%2Fbacula Fix compat.cpp times git-svn-id: https://bacula.svn.sourceforge.net/svnroot/bacula/trunk@1066 91ce42f0-d328-0410-95d8-f526ca767f89 --- diff --git a/bacula/src/findlib/enable_priv.c b/bacula/src/findlib/enable_priv.c index 4095ef2296..5a35d842ee 100755 --- a/bacula/src/findlib/enable_priv.c +++ b/bacula/src/findlib/enable_priv.c @@ -37,7 +37,7 @@ /* */ /*=============================================================*/ -#if !defined(HAVE_CYGWIN) && !defined(WIN32) +#if !defined(HAVE_CYGWIN) && !defined(HAVE_WIN32) int enable_backup_privileges(JCR *jcr, int ignore_errors) { return 0; } @@ -53,7 +53,7 @@ int enable_backup_privileges(JCR *jcr, int ignore_errors) /* */ /*=============================================================*/ -#if defined(HAVE_CYGWIN) || defined(WIN32) +#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) void win_error(JCR *jcr, char *prefix, DWORD lerror); diff --git a/bacula/src/findlib/makepath.c b/bacula/src/findlib/makepath.c index 2932b83e4a..69ef9c9e97 100644 --- a/bacula/src/findlib/makepath.c +++ b/bacula/src/findlib/makepath.c @@ -135,7 +135,7 @@ make_dir(JCR *jcr, const char *dir, const char *dirpath, mode_t mode, int *creat int isAbsolute(const char *path) { -#if defined(HAVE_CYGWIN) || defined(WIN32) +#if defined(HAVE_CYGWIN) || defined(HAVE_WIN32) return path[1] == ':' || *path == '/' || *path == '\\'; /* drivespec:/blah is absolute */ #else return *path == '/'; diff --git a/bacula/src/lib/util.c b/bacula/src/lib/util.c index 8f30486689..013c9102d3 100644 --- a/bacula/src/lib/util.c +++ b/bacula/src/lib/util.c @@ -385,12 +385,15 @@ int do_shell_expansion(char *name, int name_len) pm_strcat(&cmd, name); pm_strcat(&cmd, "\""); Dmsg1(400, "Send: %s\n", cmd); - bpipe = open_bpipe(cmd, 0, "r"); - *line = 0; - fgets(line, sizeof(line), bpipe->rfd); - strip_trailing_junk(line); - stat = close_bpipe(bpipe); - Dmsg2(400, "stat=%d got: %s\n", stat, line); + if ((bpipe = open_bpipe(cmd, 0, "r"))) { + *line = 0; + fgets(line, sizeof(line), bpipe->rfd); + strip_trailing_junk(line); + stat = close_bpipe(bpipe); + Dmsg2(400, "stat=%d got: %s\n", stat, line); + } else { + stat = 1; /* error */ + } free_pool_memory(cmd); if (stat == 0) { bstrncpy(name, line, name_len); @@ -416,7 +419,7 @@ void make_session_key(char *key, char *seed, int mode) s[0] = 0; if (seed != NULL) { - strcat(s, seed); + bstrncat(s, seed, sizeof(s)); } /* The following creates a seed for the session key generator @@ -426,11 +429,11 @@ void make_session_key(char *key, char *seed, int mode) available on your machine, replace it with something equivalent or, if you like, just delete it. */ - sprintf(s + strlen(s), "%lu", (unsigned long) getpid()); - sprintf(s + strlen(s), "%lu", (unsigned long) getppid()); + sprintf(s + strlen(s), "%lu", (unsigned long)getpid()); + sprintf(s + strlen(s), "%lu", (unsigned long)getppid()); getcwd(s + strlen(s), 256); - sprintf(s + strlen(s), "%lu", (unsigned long) clock()); - sprintf(s + strlen(s), "%lu", (unsigned long) time(NULL)); + sprintf(s + strlen(s), "%lu", (unsigned long)clock()); + sprintf(s + strlen(s), "%lu", (unsigned long)time(NULL)); #ifdef Solaris sysinfo(SI_HW_SERIAL,s + strlen(s), 12); #endif @@ -446,27 +449,27 @@ void make_session_key(char *key, char *seed, int mode) MD5Init(&md5c); MD5Update(&md5c, (unsigned char *)s, strlen(s)); MD5Final(md5key, &md5c); - sprintf(s + strlen(s), "%lu", (unsigned long) ((time(NULL) + 65121) ^ 0x375F)); + sprintf(s + strlen(s), "%lu", (unsigned long)((time(NULL) + 65121) ^ 0x375F)); MD5Init(&md5c); MD5Update(&md5c, (unsigned char *)s, strlen(s)); MD5Final(md5key1, &md5c); #define nextrand (md5key[j] ^ md5key1[j]) if (mode) { for (j = k = 0; j < 16; j++) { - unsigned char rb = nextrand; + unsigned char rb = nextrand; #define Rad16(x) ((x) + 'A') - key[k++] = Rad16((rb >> 4) & 0xF); - key[k++] = Rad16(rb & 0xF); + key[k++] = Rad16((rb >> 4) & 0xF); + key[k++] = Rad16(rb & 0xF); #undef Rad16 - if (j & 1) { - key[k++] = '-'; - } + if (j & 1) { + key[k++] = '-'; + } } key[--k] = 0; } else { for (j = 0; j < 16; j++) { - key[j] = nextrand; + key[j] = nextrand; } } } diff --git a/bacula/src/version.h b/bacula/src/version.h index d63412bcd5..55693f2402 100644 --- a/bacula/src/version.h +++ b/bacula/src/version.h @@ -2,8 +2,8 @@ #undef VERSION #define VERSION "1.33.4" #define VSTRING "1" -#define BDATE "18 Feb 2004" -#define LSMDATE "18Feb04" +#define BDATE "22 Feb 2004" +#define LSMDATE "22Feb04" /* Debug flags */ #undef DEBUG