X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Freadahead%2Freadahead-common.c;h=49679fc8343303e56ee460bb14aa4212a862d3bd;hb=9b3310b066136b0674a926da094b7fe87a13a58b;hp=aea1fbeea4ff8fe02e8f226f7b5c5f25ecb65363;hpb=1ca208fb4f93e5869704af1812cbff7130a2fc03;p=elogind.git diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c index aea1fbeea..49679fc83 100644 --- a/src/readahead/readahead-common.c +++ b/src/readahead/readahead-common.c @@ -75,7 +75,7 @@ int fs_on_ssd(const char *p) { if (major(st.st_dev) == 0) { _cleanup_fclose_ FILE *f = NULL; int mount_id; - struct file_handle *h; + union file_handle_union h = { .handle.handle_bytes = MAX_HANDLE_SZ, }; /* Might be btrfs, which exposes "ssd" as mount flag if it is on ssd. * @@ -83,9 +83,7 @@ int fs_on_ssd(const char *p) { * and then lookup the mount ID in mountinfo to find * the mount options. */ - h = alloca(MAX_HANDLE_SZ); - h->handle_bytes = MAX_HANDLE_SZ; - r = name_to_handle_at(AT_FDCWD, p, h, &mount_id, AT_SYMLINK_FOLLOW); + r = name_to_handle_at(AT_FDCWD, p, &h.handle, &mount_id, AT_SYMLINK_FOLLOW); if (r < 0) return false; @@ -220,7 +218,7 @@ int open_inotify(void) { if (inotify_add_watch(fd, "/run/systemd/readahead", IN_CREATE) < 0) { log_error("Failed to watch /run/systemd/readahead: %m"); - close_nointr_nofail(fd); + safe_close(fd); return -errno; }