fstab-util: use pointer returned by startswith()
This commit is contained in:
+14
-8
@@ -305,19 +305,25 @@ static char *tag_to_udev_node(const char *tagvalue, const char *by) {
|
||||
}
|
||||
|
||||
char *fstab_node_to_udev_node(const char *p) {
|
||||
const char *q;
|
||||
|
||||
assert(p);
|
||||
|
||||
if (startswith(p, "LABEL="))
|
||||
return tag_to_udev_node(p+6, "label");
|
||||
q = startswith(p, "LABEL=");
|
||||
if (q)
|
||||
return tag_to_udev_node(q, "label");
|
||||
|
||||
if (startswith(p, "UUID="))
|
||||
return tag_to_udev_node(p+5, "uuid");
|
||||
q = startswith(p, "UUID=");
|
||||
if (q)
|
||||
return tag_to_udev_node(q, "uuid");
|
||||
|
||||
if (startswith(p, "PARTUUID="))
|
||||
return tag_to_udev_node(p+9, "partuuid");
|
||||
q = startswith(p, "PARTUUID=");
|
||||
if (q)
|
||||
return tag_to_udev_node(q, "partuuid");
|
||||
|
||||
if (startswith(p, "PARTLABEL="))
|
||||
return tag_to_udev_node(p+10, "partlabel");
|
||||
q = startswith(p, "PARTLABEL=");
|
||||
if (q)
|
||||
return tag_to_udev_node(q, "partlabel");
|
||||
|
||||
return strdup(p);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user