X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=common-src%2Ffile.c;h=e8de92c62677904e4d4b06aa20aa3251e6f143eb;hb=3469241adf5f8b45020b0896ee13d17c4c7a2abf;hp=5446391ee804c9a7ef9d34cc2085957dc7cf375a;hpb=94a044f90357edefa6f4ae9f0b1d5885b0e34aee;p=debian%2Famanda diff --git a/common-src/file.c b/common-src/file.c index 5446391..e8de92c 100644 --- a/common-src/file.c +++ b/common-src/file.c @@ -47,19 +47,19 @@ static int mk1dir( const char *dir, /* directory to create */ mode_t mode, /* mode for new directory */ - uid_t G_GNUC_UNUSED uid, /* uid for new directory */ - gid_t G_GNUC_UNUSED gid) /* gid for new directory */ + uid_t uid, /* uid for new directory */ + gid_t gid) /* gid for new directory */ { int rc; /* return code */ rc = mkdir(dir, mode); - if(rc != 0) { /* maybe someone beat us to it */ + if(rc != 0) { int serrno; serrno = errno; - if(access(dir, F_OK) != 0) - rc = -1; - errno = serrno; /* pass back the real error */ + if(access(dir, F_OK) == 0) + rc = 0; /* someone just beat us to it, so it's OK */ + errno = serrno; } /* mkdir is affected by umask, so set the mode bits manually */ @@ -203,11 +203,11 @@ safe_cd(void) if (client_uid != (uid_t) -1) { #if defined(AMANDA_DBGDIR) d = stralloc2(AMANDA_DBGDIR, "/."); - (void) mkpdir(d, (mode_t)02700, client_uid, client_gid); + (void) mkpdir(d, (mode_t)0700, client_uid, client_gid); amfree(d); #endif d = stralloc2(AMANDA_TMPDIR, "/."); - (void) mkpdir(d, (mode_t)02700, client_uid, client_gid); + (void) mkpdir(d, (mode_t)0700, client_uid, client_gid); amfree(d); } @@ -473,7 +473,7 @@ debug_agets( } if (ch == '\\') { - escape = 1; + escape = !escape; } else { if (ch == '"') { if (!escape)