Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
Incognito VM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
flg_bachelors
TS
2024
Incognito VM
Commits
b9633ebb
Commit
b9633ebb
authored
7 months ago
by
Lennart Poettering
Browse files
Options
Downloads
Patches
Plain Diff
fs-util: move attempts counter in openat_report_new() into loop
parent
4ffecbbb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/basic/fs-util.c
+1
-2
1 addition, 2 deletions
src/basic/fs-util.c
with
1 addition
and
2 deletions
src/basic/fs-util.c
+
1
−
2
View file @
b9633ebb
...
@@ -1077,7 +1077,6 @@ int open_mkdir_at_full(int dirfd, const char *path, int flags, XOpenFlags xopen_
...
@@ -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
)
{
int
openat_report_new
(
int
dirfd
,
const
char
*
pathname
,
int
flags
,
mode_t
mode
,
bool
*
ret_newly_created
)
{
unsigned
attempts
=
7
;
int
fd
;
int
fd
;
/* Just like openat(), but adds one thing: optionally returns whether we created the file anew or if
/* 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
...
@@ -1099,7 +1098,7 @@ int openat_report_new(int dirfd, const char *pathname, int flags, mode_t mode, b
return
fd
;
return
fd
;
}
}
for
(;;)
{
for
(
unsigned
attempts
=
7
;;)
{
/* First, attempt to open without O_CREAT/O_EXCL, i.e. open existing file */
/* First, attempt to open without O_CREAT/O_EXCL, i.e. open existing file */
fd
=
openat
(
dirfd
,
pathname
,
flags
&
~
(
O_CREAT
|
O_EXCL
),
mode
);
fd
=
openat
(
dirfd
,
pathname
,
flags
&
~
(
O_CREAT
|
O_EXCL
),
mode
);
if
(
fd
>=
0
)
{
if
(
fd
>=
0
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment