]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lib/sysfs: allow parent redirect even for non-queue files
authorThomas Weißschuh <thomas@t-8ch.de>
Wed, 28 Dec 2022 01:41:42 +0000 (01:41 +0000)
committerThomas Weißschuh <thomas@t-8ch.de>
Wed, 28 Dec 2022 12:34:20 +0000 (12:34 +0000)
We will also need this redirect for other sysfs files.

lib/sysfs.c

index 56eea5c6450a311bc45e4708bac031c19f349a15..4dfa54fa982f4d96879b1814040dc8364f35f22a 100644 (file)
@@ -155,8 +155,8 @@ struct path_cxt *sysfs_blkdev_get_parent(struct path_cxt *pc)
 }
 
 /*
- * Redirects ENOENT errors to the parent, if the path is to the queue/
- * sysfs directory. For example
+ * Redirects ENOENT errors to the parent.
+ * For example
  *
  *     /sys/dev/block/8:1/queue/logical_block_size redirects to
  *     /sys/dev/block/8:0/queue/logical_block_size
@@ -165,7 +165,7 @@ static int sysfs_blkdev_enoent_redirect(struct path_cxt *pc, const char *path, i
 {
        struct sysfs_blkdev *blk = ul_path_get_dialect(pc);
 
-       if (blk && blk->parent && path && strncmp(path, "queue/", 6) == 0) {
+       if (blk && blk->parent && path) {
                *dirfd = ul_path_get_dirfd(blk->parent);
                if (*dirfd >= 0) {
                        DBG(CXT, ul_debugobj(pc, "%s redirected to parent", path));