diff options
Diffstat (limited to 'time/zic.c')
-rw-r--r-- | time/zic.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/time/zic.c b/time/zic.c index 9ab3967e98..2e07d79196 100644 --- a/time/zic.c +++ b/time/zic.c @@ -2126,15 +2126,20 @@ char * const argname; if (!itsdir(name)) { /* ** It doesn't seem to exist, so we try to create it. + ** Double check the return. Someone may be one + ** step ahead of us. */ if (mkdir(name, 0755) != 0) { - const char *e = strerror(errno); + int save_error = errno; + if (errno == EEXIST && !itsdir(name)) { + const char *e = strerror(save_error); - (void) fprintf(stderr, - _("%s: Can't create directory %s: %s\n"), - progname, name, e); - ifree(name); - return -1; + (void) fprintf(stderr, + _("%s: Can't create directory %s: %s\n"), + progname, name, e); + ifree(name); + return -1; + } } } *cp = '/'; |