chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
mount: properly handle NULL fstype
[elogind.git]
/
src
/
mount.c
diff --git
a/src/mount.c
b/src/mount.c
index b17fe2a7d3df371ea658cd9c347672d44e5559cb..fefe76bb4daa74f0a4b41d1bfda9a654f4b91082 100644
(file)
--- a/
src/mount.c
+++ b/
src/mount.c
@@
-282,7
+282,7
@@
static int mount_add_target_links(Mount *m) {
automount = !!mount_test_option(p->options, "comment=systemd.automount");
if (mount_test_option(p->options, "_netdev") ||
automount = !!mount_test_option(p->options, "comment=systemd.automount");
if (mount_test_option(p->options, "_netdev") ||
-
fstype_is_network(p->fstype
)) {
+
(p->fstype && fstype_is_network(p->fstype)
)) {
target = SPECIAL_REMOTE_FS_TARGET;
if (m->meta.manager->running_as == MANAGER_SYSTEM)
target = SPECIAL_REMOTE_FS_TARGET;
if (m->meta.manager->running_as == MANAGER_SYSTEM)
@@
-794,7
+794,7
@@
static void mount_enter_mounting(Mount *m) {
"/bin/mount",
m->parameters_fragment.what,
m->where,
"/bin/mount",
m->parameters_fragment.what,
m->where,
- "-t", m->parameters_fragment.fstype,
+ "-t", m->parameters_fragment.fstype
? m->parameters_fragment.fstype : "auto"
,
m->parameters_fragment.options ? "-o" : NULL, m->parameters_fragment.options,
NULL);
else if (m->from_etc_fstab)
m->parameters_fragment.options ? "-o" : NULL, m->parameters_fragment.options,
NULL);
else if (m->from_etc_fstab)
@@
-859,7
+859,7
@@
static void mount_enter_remounting(Mount *m, bool success) {
"/bin/mount",
m->parameters_fragment.what,
m->where,
"/bin/mount",
m->parameters_fragment.what,
m->where,
- "-t", m->parameters_fragment.fstype,
+ "-t", m->parameters_fragment.fstype
? m->parameters_fragment.fstype : "auto"
,
"-o", o,
NULL);
"-o", o,
NULL);
@@
-1408,13
+1408,14
@@
finish:
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
int r;
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
int r;
+ unsigned i;
char *device, *path, *options, *options2, *fstype, *d, *p, *o;
assert(m);
rewind(m->proc_self_mountinfo);
char *device, *path, *options, *options2, *fstype, *d, *p, *o;
assert(m);
rewind(m->proc_self_mountinfo);
- for (
;;
) {
+ for (
i = 1;; i++
) {
int k;
device = path = options = options2 = fstype = d = p = o = NULL;
int k;
device = path = options = options2 = fstype = d = p = o = NULL;
@@
-1441,8
+1442,8
@@
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
if (k == EOF)
break;
if (k == EOF)
break;
-
r = -EBADMSG
;
- goto
finish
;
+
log_warning("Failed to parse /proc/self/mountinfo:%u.", i)
;
+ goto
clean_up
;
}
if (asprintf(&o, "%s,%s", options, options2) < 0) {
}
if (asprintf(&o, "%s,%s", options, options2) < 0) {
@@
-1459,6
+1460,7
@@
static int mount_load_proc_self_mountinfo(Manager *m, bool set_flags) {
if ((r = mount_add_one(m, d, p, o, fstype, true, set_flags)) < 0)
goto finish;
if ((r = mount_add_one(m, d, p, o, fstype, true, set_flags)) < 0)
goto finish;
+clean_up:
free(device);
free(path);
free(options);
free(device);
free(path);
free(options);