]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
It's fine if the dir we're making already exists
authorArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 22 Oct 2022 08:21:02 +0000 (04:21 -0400)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Sat, 22 Oct 2022 08:21:02 +0000 (04:21 -0400)
src/lib/util/file.c

index be45dd36b1726fd74b36f9159fee68a57386bf90..dcad23cfd72caf9564bf6c3fcc75c40eba16b787 100644 (file)
@@ -104,8 +104,11 @@ static ssize_t _fr_mkdir(int *fd_out, char const *path, mode_t mode, fr_mkdir_fu
        /*
         *      At this point *fd_out, should be an FD
         *      for the containing directory.
+        *
+        *      Dir may already exist if we're racing
+        *      other processes as we do in CI.
         */
-       if (mkdirat(*fd_out, p + 1, 0700) < 0) {
+       if ((mkdirat(*fd_out, p + 1, 0700) < 0) && (errno != EEXIST)) {
                fr_strerror_printf("Failed creating directory: %s", fr_syserror(errno));
        mkdirat_error:
                close(*fd_out);