chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
bus-proxy: we don't pointlessly abbreviate function names
[elogind.git]
/
src
/
remount-fs
/
remount-fs.c
diff --git
a/src/remount-fs/remount-fs.c
b/src/remount-fs/remount-fs.c
index ef68e506e5097da4628acad62cb5af547a800042..57b47021e4431526ec32c4b34c806d330f0d722a 100644
(file)
--- a/
src/remount-fs/remount-fs.c
+++ b/
src/remount-fs/remount-fs.c
@@
-40,7
+40,7
@@
int main(int argc, char *argv[]) {
int ret = EXIT_FAILURE;
int main(int argc, char *argv[]) {
int ret = EXIT_FAILURE;
- FILE *f = NULL;
+
_cleanup_endmntent_
FILE *f = NULL;
struct mntent* me;
Hashmap *pids = NULL;
struct mntent* me;
Hashmap *pids = NULL;
@@
-57,16
+57,14
@@
int main(int argc, char *argv[]) {
f = setmntent("/etc/fstab", "r");
if (!f) {
f = setmntent("/etc/fstab", "r");
if (!f) {
- if (errno == ENOENT) {
- ret = EXIT_SUCCESS;
- goto finish;
- }
+ if (errno == ENOENT)
+ return EXIT_SUCCESS;
- log_error
(
"Failed to open /etc/fstab: %m");
-
goto finish
;
+ log_error
_errno(errno,
"Failed to open /etc/fstab: %m");
+
return EXIT_FAILURE
;
}
}
- pids = hashmap_new(
trivial_hash_func, trivial_compare_func
);
+ pids = hashmap_new(
NULL
);
if (!pids) {
log_error("Failed to allocate set");
goto finish;
if (!pids) {
log_error("Failed to allocate set");
goto finish;
@@
-79,16
+77,17
@@
int main(int argc, char *argv[]) {
int k;
char *s;
int k;
char *s;
- /* Remount the root fs and all API VFS */
+ /* Remount the root fs
, /usr
and all API VFS */
if (!mount_point_is_api(me->mnt_dir) &&
if (!mount_point_is_api(me->mnt_dir) &&
- !path_equal(me->mnt_dir, "/"))
+ !path_equal(me->mnt_dir, "/") &&
+ !path_equal(me->mnt_dir, "/usr"))
continue;
log_debug("Remounting %s", me->mnt_dir);
pid = fork();
if (pid < 0) {
continue;
log_debug("Remounting %s", me->mnt_dir);
pid = fork();
if (pid < 0) {
- log_error
(
"Failed to fork: %m");
+ log_error
_errno(errno,
"Failed to fork: %m");
ret = EXIT_FAILURE;
continue;
}
ret = EXIT_FAILURE;
continue;
}
@@
-105,7
+104,7
@@
int main(int argc, char *argv[]) {
execv("/bin/mount", (char **) arguments);
execv("/bin/mount", (char **) arguments);
- log_error
(
"Failed to execute /bin/mount: %m");
+ log_error
_errno(errno,
"Failed to execute /bin/mount: %m");
_exit(EXIT_FAILURE);
}
_exit(EXIT_FAILURE);
}
@@
-113,7
+112,7
@@
int main(int argc, char *argv[]) {
s = strdup(me->mnt_dir);
if (!s) {
s = strdup(me->mnt_dir);
if (!s) {
- log_
error("Out of memory."
);
+ log_
oom(
);
ret = EXIT_FAILURE;
continue;
}
ret = EXIT_FAILURE;
continue;
}
@@
-121,30
+120,29
@@
int main(int argc, char *argv[]) {
k = hashmap_put(pids, UINT_TO_PTR(pid), s);
if (k < 0) {
k = hashmap_put(pids, UINT_TO_PTR(pid), s);
if (k < 0) {
- log_error
("Failed to add PID to set: %s", strerror(-k)
);
+ log_error
_errno(k, "Failed to add PID to set: %m"
);
ret = EXIT_FAILURE;
continue;
}
}
while (!hashmap_isempty(pids)) {
ret = EXIT_FAILURE;
continue;
}
}
while (!hashmap_isempty(pids)) {
- siginfo_t si;
+ siginfo_t si
= {}
;
char *s;
char *s;
- zero(si);
if (waitid(P_ALL, 0, &si, WEXITED) < 0) {
if (errno == EINTR)
continue;
if (waitid(P_ALL, 0, &si, WEXITED) < 0) {
if (errno == EINTR)
continue;
- log_error
(
"waitid() failed: %m");
+ log_error
_errno(errno,
"waitid() failed: %m");
ret = EXIT_FAILURE;
break;
}
s = hashmap_remove(pids, UINT_TO_PTR(si.si_pid));
if (s) {
ret = EXIT_FAILURE;
break;
}
s = hashmap_remove(pids, UINT_TO_PTR(si.si_pid));
if (s) {
- if (!is_clean_exit(si.si_code, si.si_status)) {
+ if (!is_clean_exit(si.si_code, si.si_status
, NULL
)) {
if (si.si_code == CLD_EXITED)
log_error("/bin/mount for %s exited with exit status %i.", s, si.si_status);
else
if (si.si_code == CLD_EXITED)
log_error("/bin/mount for %s exited with exit status %i.", s, si.si_status);
else
@@
-162,8
+160,5
@@
finish:
if (pids)
hashmap_free_free(pids);
if (pids)
hashmap_free_free(pids);
- if (f)
- endmntent(f);
-
return ret;
}
return ret;
}