diff --git a/publish_video.c b/publish_video.c index 42736625c7dc615fcfc66211eef44645ead1bfa4..a6bd8535b4d38c28d93e967410e7857c60277ed7 100644 --- a/publish_video.c +++ b/publish_video.c @@ -16,7 +16,7 @@ int main(int argc, char *argv[]) ping_job(jobid, "running", 0); src = buildpath(getenv(WORKER_TMP), jstr(jlookup(argv[4], "source"), 0)); destdir = buildpath(getenv(WORKER_RELEASED), dirname(jstr(jlookup(argv[4], "path"), 0))); - if (mkdir(destdir, 02775) && errno != EEXIST) + if (access(destdir, F_OK) && mkdir(destdir, 02775)) job_failed("Could not create target directory \"%s\": %s", destdir, strerror(errno)); dest = buildpath(getenv(WORKER_RELEASED), jstr(jlookup(argv[4], "path"), 0)); overwrite_check(dest, 0, 0);