mount: properly handle LABEL="" in fstab
This commit is contained in:
parent
049f86421b
commit
11ce342724
2
fixme
2
fixme
|
@ -60,8 +60,6 @@
|
||||||
|
|
||||||
* bash completion a la gdbus
|
* bash completion a la gdbus
|
||||||
|
|
||||||
* fstab mit tüdelchen
|
|
||||||
|
|
||||||
* api mounts gegen fstab mergen und remounten
|
* api mounts gegen fstab mergen und remounten
|
||||||
|
|
||||||
External:
|
External:
|
||||||
|
|
18
src/mount.c
18
src/mount.c
|
@ -1175,7 +1175,7 @@ fail:
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *fstab_node_to_udev_node(char *p) {
|
static char *fstab_node_to_udev_node(char *p) {
|
||||||
char *dn, *t;
|
char *dn, *t, *u;
|
||||||
int r;
|
int r;
|
||||||
|
|
||||||
/* FIXME: to follow udev's logic 100% we need to leave valid
|
/* FIXME: to follow udev's logic 100% we need to leave valid
|
||||||
|
@ -1183,7 +1183,13 @@ static char *fstab_node_to_udev_node(char *p) {
|
||||||
|
|
||||||
if (startswith(p, "LABEL=")) {
|
if (startswith(p, "LABEL=")) {
|
||||||
|
|
||||||
if (!(t = xescape(p+6, "/ ")))
|
if (!(u = unquote(p+6, '"')))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
t = xescape(u, "/ ");
|
||||||
|
free(u);
|
||||||
|
|
||||||
|
if (!t)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
r = asprintf(&dn, "/dev/disk/by-label/%s", t);
|
r = asprintf(&dn, "/dev/disk/by-label/%s", t);
|
||||||
|
@ -1197,7 +1203,13 @@ static char *fstab_node_to_udev_node(char *p) {
|
||||||
|
|
||||||
if (startswith(p, "UUID=")) {
|
if (startswith(p, "UUID=")) {
|
||||||
|
|
||||||
if (!(t = xescape(p+5, "/ ")))
|
if (!(u = unquote(p+5, '"')))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
t = xescape(u, "/ ");
|
||||||
|
free(u);
|
||||||
|
|
||||||
|
if (!t)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
r = asprintf(&dn, "/dev/disk/by-uuid/%s", ascii_strlower(t));
|
r = asprintf(&dn, "/dev/disk/by-uuid/%s", ascii_strlower(t));
|
||||||
|
|
13
src/util.c
13
src/util.c
|
@ -3004,6 +3004,19 @@ int touch(const char *path) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *unquote(const char *s, const char quote) {
|
||||||
|
size_t l;
|
||||||
|
assert(s);
|
||||||
|
|
||||||
|
if ((l = strlen(s)) < 2)
|
||||||
|
return strdup(s);
|
||||||
|
|
||||||
|
if (s[0] == quote && s[l-1] == quote)
|
||||||
|
return strndup(s+1, l-2);
|
||||||
|
|
||||||
|
return strdup(s);
|
||||||
|
}
|
||||||
|
|
||||||
static const char *const ioprio_class_table[] = {
|
static const char *const ioprio_class_table[] = {
|
||||||
[IOPRIO_CLASS_NONE] = "none",
|
[IOPRIO_CLASS_NONE] = "none",
|
||||||
[IOPRIO_CLASS_RT] = "realtime",
|
[IOPRIO_CLASS_RT] = "realtime",
|
||||||
|
|
|
@ -339,6 +339,8 @@ char *ellipsize(const char *s, unsigned length, unsigned percent);
|
||||||
|
|
||||||
int touch(const char *path);
|
int touch(const char *path);
|
||||||
|
|
||||||
|
char *unquote(const char *s, const char quote);
|
||||||
|
|
||||||
#define NULSTR_FOREACH(i, l) \
|
#define NULSTR_FOREACH(i, l) \
|
||||||
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
|
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue