mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-20 15:03:44 +02:00
lbutils/file: tidy up mkhtemp_tmpfile_linux
make failure more obvious. no behavioural change. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -694,7 +694,14 @@ mkhtemp_tmpfile_linux(int dirfd,
|
|||||||
st_dir_first) < 0)
|
st_dir_first) < 0)
|
||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
if (linkat(tmpfd, "", dirfd, fname_copy, AT_EMPTY_PATH) == 0) {
|
if (linkat(tmpfd, "", dirfd,
|
||||||
|
fname_copy, AT_EMPTY_PATH) == -1) {
|
||||||
|
|
||||||
|
if (errno == EEXIST)
|
||||||
|
continue; /* retry on collision */
|
||||||
|
else
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
linked = 1; /* file created */
|
linked = 1; /* file created */
|
||||||
|
|
||||||
@@ -710,12 +717,6 @@ mkhtemp_tmpfile_linux(int dirfd,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errno != EEXIST)
|
|
||||||
goto err;
|
|
||||||
|
|
||||||
/* retry on collision */
|
|
||||||
}
|
|
||||||
|
|
||||||
errno = EEXIST;
|
errno = EEXIST;
|
||||||
err:
|
err:
|
||||||
if (linked)
|
if (linked)
|
||||||
|
|||||||
Reference in New Issue
Block a user