mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 00:14:32 +09:00
repart: fix generation of UUID= line for vfat in fstab entries
Fixes: #36735
This commit is contained in:
@@ -7587,6 +7587,29 @@ static bool need_fstab(const Context *context) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static int make_by_uuid_symlink_path(const Partition *p, char **ret) {
|
||||
_cleanup_free_ char *what = NULL;
|
||||
|
||||
assert(p);
|
||||
assert(ret);
|
||||
|
||||
if (streq_ptr(p->format, "vfat")) {
|
||||
if (asprintf(&what, "UUID=%04X-%04X",
|
||||
((uint32_t) p->fs_uuid.bytes[0] << 8) |
|
||||
((uint32_t) p->fs_uuid.bytes[1] << 0),
|
||||
((uint32_t) p->fs_uuid.bytes[2] << 8) |
|
||||
((uint32_t) p->fs_uuid.bytes[3])) < 0) /* Take first 32 bytes of UUID */
|
||||
return log_oom();
|
||||
} else {
|
||||
what = strjoin("UUID=", SD_ID128_TO_UUID_STRING(p->fs_uuid));
|
||||
if (!what)
|
||||
return log_oom();
|
||||
}
|
||||
|
||||
*ret = TAKE_PTR(what);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int context_fstab(Context *context) {
|
||||
_cleanup_(unlink_and_freep) char *t = NULL;
|
||||
_cleanup_fclose_ FILE *f = NULL;
|
||||
@@ -7620,9 +7643,9 @@ static int context_fstab(Context *context) {
|
||||
if (!need_fstab_one(p))
|
||||
continue;
|
||||
|
||||
what = strjoin("UUID=", SD_ID128_TO_UUID_STRING(p->fs_uuid));
|
||||
if (!what)
|
||||
return log_oom();
|
||||
r = make_by_uuid_symlink_path(p, &what);
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
FOREACH_ARRAY(mountpoint, p->mountpoints, p->n_mountpoints) {
|
||||
r = partition_pick_mount_options(
|
||||
|
||||
Reference in New Issue
Block a user