chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
test: add test for crash when adding a JOB_NOP
[elogind.git]
/
src
/
gpt-auto-generator
/
gpt-auto-generator.c
diff --git
a/src/gpt-auto-generator/gpt-auto-generator.c
b/src/gpt-auto-generator/gpt-auto-generator.c
index cd24d9483ac4837705905f94ed2d455f7ce6711d..9251ddff75ba15d625a04d5cf29b753ce285e31d 100644
(file)
--- a/
src/gpt-auto-generator/gpt-auto-generator.c
+++ b/
src/gpt-auto-generator/gpt-auto-generator.c
@@
-124,7
+124,7
@@
static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
return log_oom();
p = strjoin(arg_dest, "/", n, NULL);
return log_oom();
p = strjoin(arg_dest, "/", n, NULL);
- if (!
n
)
+ if (!
p
)
return log_oom();
f = fopen(p, "wxe");
return log_oom();
f = fopen(p, "wxe");
@@
-144,7
+144,6
@@
static int add_cryptsetup(const char *id, const char *what, bool rw, char **devi
"Before=umount.target cryptsetup.target\n"
"After=%s\n"
"IgnoreOnIsolate=true\n"
"Before=umount.target cryptsetup.target\n"
"After=%s\n"
"IgnoreOnIsolate=true\n"
- "After=systemd-readahead-collect.service systemd-readahead-replay.service\n\n"
"[Service]\n"
"Type=oneshot\n"
"RemainAfterExit=yes\n"
"[Service]\n"
"Type=oneshot\n"
"RemainAfterExit=yes\n"
@@
-395,22
+394,30
@@
static int enumerate_partitions(dev_t devnum) {
return log_oom();
parent = udev_device_get_parent(d);
return log_oom();
parent = udev_device_get_parent(d);
- if (!parent)
+ if (!parent) {
+ log_debug("Not a partitioned device, ignoring.");
return 0;
return 0;
+ }
/* Does it have a devtype? */
devtype = udev_device_get_devtype(parent);
/* Does it have a devtype? */
devtype = udev_device_get_devtype(parent);
- if (!devtype)
+ if (!devtype) {
+ log_debug("Parent doesn't have a device type, ignoring.");
return 0;
return 0;
+ }
/* Is this a disk or a partition? We only care for disks... */
/* Is this a disk or a partition? We only care for disks... */
- if (!streq(devtype, "disk"))
+ if (!streq(devtype, "disk")) {
+ log_debug("Parent isn't a raw disk, ignoring.");
return 0;
return 0;
+ }
/* Does it have a device node? */
node = udev_device_get_devnode(parent);
/* Does it have a device node? */
node = udev_device_get_devnode(parent);
- if (!node)
+ if (!node) {
+ log_debug("Parent device does not have device node, ignoring.");
return 0;
return 0;
+ }
log_debug("Root device %s.", node);
log_debug("Root device %s.", node);
@@
-428,8
+435,6
@@
static int enumerate_partitions(dev_t devnum) {
return -errno;
}
return -errno;
}
- blkid_probe_enable_superblocks(b, 1);
- blkid_probe_set_superblocks_flags(b, BLKID_SUBLKS_TYPE);
blkid_probe_enable_partitions(b, 1);
blkid_probe_set_partitions_flags(b, BLKID_PARTS_ENTRY_DETAILS);
blkid_probe_enable_partitions(b, 1);
blkid_probe_set_partitions_flags(b, BLKID_PARTS_ENTRY_DETAILS);
@@
-454,8
+459,10
@@
static int enumerate_partitions(dev_t devnum) {
}
/* We only do this all for GPT... */
}
/* We only do this all for GPT... */
- if (!streq_ptr(pttype, "gpt"))
+ if (!streq_ptr(pttype, "gpt")) {
+ log_debug("Not a GPT partition table, ignoring.");
return 0;
return 0;
+ }
errno = 0;
pl = blkid_probe_get_partitions(b);
errno = 0;
pl = blkid_probe_get_partitions(b);
@@
-673,8
+680,8
@@
static int parse_proc_cmdline_item(const char *key, const char *value) {
r = parse_boolean(value);
if (r < 0)
log_warning("Failed to parse gpt-auto switch %s. Ignoring.", value);
r = parse_boolean(value);
if (r < 0)
log_warning("Failed to parse gpt-auto switch %s. Ignoring.", value);
-
- arg_enabled = r;
+ else
+
arg_enabled = r;
} else if (streq(key, "root") && value) {
} else if (streq(key, "root") && value) {
@@
-687,8
+694,6
@@
static int parse_proc_cmdline_item(const char *key, const char *value) {
arg_root_rw = true;
else if (streq(key, "ro") && !value)
arg_root_rw = false;
arg_root_rw = true;
else if (streq(key, "ro") && !value)
arg_root_rw = false;
- else if (startswith(key, "systemd.gpt-auto.") || startswith(key, "rd.systemd.gpt-auto."))
- log_warning("Unknown kernel switch %s. Ignoring.", key);
return 0;
}
return 0;
}
@@
-767,8
+772,9
@@
int main(int argc, char *argv[]) {
return EXIT_SUCCESS;
}
return EXIT_SUCCESS;
}
- if (parse_proc_cmdline(parse_proc_cmdline_item) < 0)
- return EXIT_FAILURE;
+ r = parse_proc_cmdline(parse_proc_cmdline_item);
+ if (r < 0)
+ log_warning("Failed to parse kernel command line, ignoring: %s", strerror(-r));
if (!arg_enabled) {
log_debug("Disabled, exiting.");
if (!arg_enabled) {
log_debug("Disabled, exiting.");