From: Arran Cudbard-Bell Date: Sat, 22 Oct 2022 08:21:02 +0000 (-0400) Subject: It's fine if the dir we're making already exists X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cc278a09694a44f115e30057381727a040a57e3d;p=thirdparty%2Ffreeradius-server.git It's fine if the dir we're making already exists --- diff --git a/src/lib/util/file.c b/src/lib/util/file.c index be45dd36b17..dcad23cfd72 100644 --- a/src/lib/util/file.c +++ b/src/lib/util/file.c @@ -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);