Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
steam-runtime-tools
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
steamrt
steam-runtime-tools
Commits
667d8aa7
Commit
667d8aa7
authored
7 years ago
by
Colin Walters
Browse files
Options
Downloads
Patches
Plain Diff
tree-wide: Use our own syscall wrappers or error prefixing
Followup to similar commits in the ostree stack recently.
parent
0428fd87
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
glnx-dirfd.c
+3
-2
3 additions, 2 deletions
glnx-dirfd.c
glnx-fdio.c
+12
-14
12 additions, 14 deletions
glnx-fdio.c
glnx-lockfile.c
+3
-4
3 additions, 4 deletions
glnx-lockfile.c
with
18 additions
and
20 deletions
glnx-dirfd.c
+
3
−
2
View file @
667d8aa7
...
...
@@ -23,6 +23,7 @@
#include
<string.h>
#include
<glnx-dirfd.h>
#include
<glnx-fdio.h>
#include
<glnx-errors.h>
#include
<glnx-local-alloc.h>
#include
<glnx-shutil.h>
...
...
@@ -204,8 +205,8 @@ glnx_dirfd_iterator_next_dent_ensure_dtype (GLnxDirFdIterator *dfd_iter,
if
(
ret_dent
->
d_type
==
DT_UNKNOWN
)
{
struct
stat
stbuf
;
if
(
TEMP_FAILURE_RETRY
(
fstatat
(
dfd_iter
->
fd
,
ret_dent
->
d_name
,
&
stbuf
,
AT_SYMLINK_NOFOLLOW
))
!=
0
)
return
glnx_throw_errno
(
error
)
;
if
(
!
glnx_
fstatat
(
dfd_iter
->
fd
,
ret_dent
->
d_name
,
&
stbuf
,
AT_SYMLINK_NOFOLLOW
,
error
)
)
return
FALSE
;
ret_dent
->
d_type
=
IFTODT
(
stbuf
.
st_mode
);
}
}
...
...
This diff is collapsed.
Click to expand it.
glnx-fdio.c
+
12
−
14
View file @
667d8aa7
...
...
@@ -112,7 +112,7 @@ rename_file_noreplace_at (int olddirfd, const char *oldpath,
return
TRUE
;
}
else
return
glnx_throw_errno
(
error
);
return
glnx_throw_errno
_prefix
(
error
,
"renameat"
);
}
return
TRUE
;
}
...
...
@@ -442,8 +442,8 @@ glnx_fd_readall_malloc (int fd,
const
guint
maxreadlen
=
4096
;
struct
stat
stbuf
;
if
(
TEMP_FAILURE_RETRY
(
fstat
(
fd
,
&
stbuf
))
<
0
)
return
glnx_null_throw_errno
(
error
)
;
if
(
!
glnx_
fstat
(
fd
,
&
stbuf
,
error
)
)
return
FALSE
;
gsize
buf_allocated
;
if
(
S_ISREG
(
stbuf
.
st_mode
)
&&
stbuf
.
st_size
>
0
)
...
...
@@ -611,7 +611,7 @@ glnx_readlinkat_malloc (int dfd,
c
=
g_malloc
(
l
);
n
=
TEMP_FAILURE_RETRY
(
readlinkat
(
dfd
,
subpath
,
c
,
l
-
1
));
if
(
n
<
0
)
return
glnx_null_throw_errno
(
error
);
return
glnx_null_throw_errno
_prefix
(
error
,
"readlinkat"
);
if
((
size_t
)
n
<
l
-
1
)
{
...
...
@@ -658,7 +658,7 @@ copy_symlink_at (int src_dfd,
if
(
TEMP_FAILURE_RETRY
(
fchownat
(
dest_dfd
,
dest_subpath
,
src_stbuf
->
st_uid
,
src_stbuf
->
st_gid
,
AT_SYMLINK_NOFOLLOW
))
!=
0
)
return
glnx_throw_errno
(
error
);
return
glnx_throw_errno
_prefix
(
error
,
"fchownat"
);
return
TRUE
;
}
...
...
@@ -1066,19 +1066,17 @@ glnx_file_replace_contents_with_perms_at (int dfd,
return
FALSE
;
if
(
glnx_loop_write
(
tmpf
.
fd
,
buf
,
len
)
<
0
)
return
glnx_throw_errno
(
error
);
return
glnx_throw_errno
_prefix
(
error
,
"write"
);
if
(
!
(
flags
&
GLNX_FILE_REPLACE_NODATASYNC
))
{
struct
stat
stbuf
;
gboolean
do_sync
;
if
(
fstatat
(
dfd
,
subpath
,
&
stbuf
,
AT_SYMLINK_NOFOLLOW
)
!=
0
)
{
if
(
errno
!=
ENOENT
)
return
glnx_throw_errno
(
error
);
do_sync
=
(
flags
&
GLNX_FILE_REPLACE_DATASYNC_NEW
)
>
0
;
}
if
(
!
glnx_fstatat_allow_noent
(
dfd
,
subpath
,
&
stbuf
,
AT_SYMLINK_NOFOLLOW
,
error
))
return
FALSE
;
if
(
errno
==
ENOENT
)
do_sync
=
(
flags
&
GLNX_FILE_REPLACE_DATASYNC_NEW
)
>
0
;
else
do_sync
=
TRUE
;
...
...
@@ -1092,11 +1090,11 @@ glnx_file_replace_contents_with_perms_at (int dfd,
if
(
uid
!=
(
uid_t
)
-
1
)
{
if
(
fchown
(
tmpf
.
fd
,
uid
,
gid
)
!=
0
)
return
glnx_throw_errno
(
error
);
return
glnx_throw_errno
_prefix
(
error
,
"fchown"
);
}
if
(
fchmod
(
tmpf
.
fd
,
mode
)
!=
0
)
return
glnx_throw_errno
(
error
);
return
glnx_throw_errno
_prefix
(
error
,
"fchmod"
);
if
(
!
glnx_link_tmpfile_at
(
&
tmpf
,
GLNX_LINK_TMPFILE_REPLACE
,
dfd
,
subpath
,
error
))
...
...
This diff is collapsed.
Click to expand it.
glnx-lockfile.c
+
3
−
4
View file @
667d8aa7
...
...
@@ -105,7 +105,7 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
r
=
flock
(
fd
,
operation
);
if
(
r
<
0
)
return
glnx_throw_errno
(
error
);
return
glnx_throw_errno
_prefix
(
error
,
"flock"
);
}
/* If we acquired the lock, let's check if the file
...
...
@@ -114,9 +114,8 @@ glnx_make_lock_file(int dfd, const char *p, int operation, GLnxLockFile *out_loc
* it. In such a case our acquired lock is worthless,
* hence try again. */
r
=
fstat
(
fd
,
&
st
);
if
(
r
<
0
)
return
glnx_throw_errno
(
error
);
if
(
!
glnx_fstat
(
fd
,
&
st
,
error
))
return
FALSE
;
if
(
st
.
st_nlink
>
0
)
break
;
...
...
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