chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
timesyncd: read global operational state from networkd
[elogind.git]
/
src
/
readahead
/
readahead-replay.c
diff --git
a/src/readahead/readahead-replay.c
b/src/readahead/readahead-replay.c
index 7bd079aae591c5459617313401fd102ae282fcca..8dc194257f07446588a28027456c0191e448ee5b 100644
(file)
--- a/
src/readahead/readahead-replay.c
+++ b/
src/readahead/readahead-replay.c
@@
-64,13
+64,11
@@
static int unpack_file(FILE *pack) {
fd = open(fn, O_RDONLY|O_CLOEXEC|O_NOATIME|O_NOCTTY|O_NOFOLLOW);
if (fd < 0) {
fd = open(fn, O_RDONLY|O_CLOEXEC|O_NOATIME|O_NOCTTY|O_NOFOLLOW);
if (fd < 0) {
- if (errno != ENOENT && errno != EPERM && errno != EACCES)
+ if (errno != ENOENT && errno != EPERM && errno != EACCES
&& errno != ELOOP
)
log_warning("open(%s) failed: %m", fn);
log_warning("open(%s) failed: %m", fn);
- } else if (file_verify(fd, fn, arg_file_size_max, &st) <= 0) {
- close_nointr_nofail(fd);
- fd = -1;
- }
+ } else if (file_verify(fd, fn, arg_file_size_max, &st) <= 0)
+ fd = safe_close(fd);
if (fread(&inode, sizeof(inode), 1, pack) != 1) {
log_error("Premature end of pack file.");
if (fread(&inode, sizeof(inode), 1, pack) != 1) {
log_error("Premature end of pack file.");
@@
-81,10
+79,8
@@
static int unpack_file(FILE *pack) {
if (fd >= 0) {
/* If the inode changed the file got deleted, so just
* ignore this entry */
if (fd >= 0) {
/* If the inode changed the file got deleted, so just
* ignore this entry */
- if (st.st_ino != (uint64_t) inode) {
- close_nointr_nofail(fd);
- fd = -1;
- }
+ if (st.st_ino != (uint64_t) inode)
+ fd = safe_close(fd);
}
for (;;) {
}
for (;;) {
@@
-129,8
+125,7
@@
static int unpack_file(FILE *pack) {
}
finish:
}
finish:
- if (fd >= 0)
- close_nointr_nofail(fd);
+ safe_close(fd);
return r;
}
return r;
}
@@
-150,8
+145,7
@@
static int replay(const char *root) {
block_bump_request_nr(root);
if (asprintf(&pack_fn, "%s/.readahead", root) < 0) {
block_bump_request_nr(root);
if (asprintf(&pack_fn, "%s/.readahead", root) < 0) {
- log_error("Out of memory");
- r = -ENOMEM;
+ r = log_oom();
goto finish;
}
goto finish;
}
@@
-280,8
+274,7
@@
finish:
if (pack)
fclose(pack);
if (pack)
fclose(pack);
- if (inotify_fd >= 0)
- close_nointr_nofail(inotify_fd);
+ safe_close(inotify_fd);
free(pack_fn);
free(pack_fn);