summaryrefslogtreecommitdiffstats
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2024-10-22 17:49:40 +0200
committerLennart Poettering <lennart@poettering.net>2024-10-22 17:51:26 +0200
commitb9633ebb2a714ada7dc9747ec53af02c3627d05c (patch)
tree0ae99e668fbe0d5a9adeaeedf0ce0c0a7f67cf41 /src/basic
parentlabel: move label_ops_reset() up a bit (diff)
downloadsystemd-b9633ebb2a714ada7dc9747ec53af02c3627d05c.tar.xz
systemd-b9633ebb2a714ada7dc9747ec53af02c3627d05c.zip
fs-util: move attempts counter in openat_report_new() into loop
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/fs-util.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/src/basic/fs-util.c b/src/basic/fs-util.c
index 9397c4b384..7c88e9fef7 100644
--- a/src/basic/fs-util.c
+++ b/src/basic/fs-util.c
@@ -1077,7 +1077,6 @@ int open_mkdir_at_full(int dirfd, const char *path, int flags, XOpenFlags xopen_
}
int openat_report_new(int dirfd, const char *pathname, int flags, mode_t mode, bool *ret_newly_created) {
- unsigned attempts = 7;
int fd;
/* Just like openat(), but adds one thing: optionally returns whether we created the file anew or if
@@ -1099,7 +1098,7 @@ int openat_report_new(int dirfd, const char *pathname, int flags, mode_t mode, b
return fd;
}
- for (;;) {
+ for (unsigned attempts = 7;;) {
/* First, attempt to open without O_CREAT/O_EXCL, i.e. open existing file */
fd = openat(dirfd, pathname, flags & ~(O_CREAT | O_EXCL), mode);
if (fd >= 0) {