chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
core: allow informing systemd about service status changes with RELOADING=1 and STOPP...
[elogind.git]
/
src
/
readahead
/
readahead-collect.c
diff --git
a/src/readahead/readahead-collect.c
b/src/readahead/readahead-collect.c
index 58b77bdcf73065944f06c8e5b6e87c52756634b7..1592cc86784ccae245c1ac0d6979e8a0d37101fe 100644
(file)
--- a/
src/readahead/readahead-collect.c
+++ b/
src/readahead/readahead-collect.c
@@
-52,7
+52,7
@@
#include <sys/fanotify.h>
#endif
#include <sys/fanotify.h>
#endif
-#include
<systemd/sd-daemon.h>
+#include
"systemd/sd-daemon.h"
#include "missing.h"
#include "util.h"
#include "missing.h"
#include "util.h"
@@
-129,8
+129,7
@@
static int pack_file(FILE *pack, const char *fn, bool on_btrfs) {
}
pages = l / page_size();
}
pages = l / page_size();
- vec = alloca(pages);
- memset(vec, 0, pages);
+ vec = alloca0(pages);
if (mincore(start, l, vec) < 0) {
log_warning("mincore(%s) failed: %m", fn);
r = -errno;
if (mincore(start, l, vec) < 0) {
log_warning("mincore(%s) failed: %m", fn);
r = -errno;
@@
-177,8
+176,7
@@
finish:
if (start != MAP_FAILED)
munmap(start, l);
if (start != MAP_FAILED)
munmap(start, l);
- if (fd >= 0)
- close_nointr_nofail(fd);
+ safe_close(fd);
return r;
}
return r;
}
@@
-494,16
+492,12
@@
static int collect(const char *root) {
log_warning("readlink(%s) failed: %s", fn, strerror(-k));
next_iteration:
log_warning("readlink(%s) failed: %s", fn, strerror(-k));
next_iteration:
- if (m->fd >= 0)
- close_nointr_nofail(m->fd);
+ safe_close(m->fd);
}
}
done:
}
}
done:
- if (fanotify_fd >= 0) {
- close_nointr_nofail(fanotify_fd);
- fanotify_fd = -1;
- }
+ fanotify_fd = safe_close(fanotify_fd);
log_debug("Writing Pack File...");
log_debug("Writing Pack File...");
@@
-593,14
+587,9
@@
done:
log_debug("Done.");
finish:
log_debug("Done.");
finish:
- if (fanotify_fd >= 0)
- close_nointr_nofail(fanotify_fd);
-
- if (signal_fd >= 0)
- close_nointr_nofail(signal_fd);
-
- if (inotify_fd >= 0)
- close_nointr_nofail(inotify_fd);
+ safe_close(fanotify_fd);
+ safe_close(signal_fd);
+ safe_close(inotify_fd);
if (pack) {
fclose(pack);
if (pack) {
fclose(pack);