}
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 (start != MAP_FAILED)
munmap(start, l);
- if (fd >= 0)
- close_nointr_nofail(fd);
+ safe_close(fd);
return r;
}
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:
- 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("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);