summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2023-01-21 12:32:23 -0800
committerTheodore Ts'o <tytso@mit.edu>2023-01-27 12:38:31 -0500
commit4d890149b97b7bf76d6c557b42c407be1b138de4 (patch)
tree372e32bfe986c499aefec6bfb189763c6681456c /include
parent44ee1fb80bd347ba92c38a4e60060229f671dcd8 (diff)
downloade2fsprogs-4d890149b97b7bf76d6c557b42c407be1b138de4.tar.gz
misc/mk_hugefiles: simplify get_partition_start()
search_sysfs_block() is causing -Wformat-truncation warnings. These could be fixed by checking the return value of snprintf(), instead of doing buggy checks like 'strlen(p_de->d_name) > SYSFS_PATH_LEN - strlen(path) - 32', which has an integer underflow bug. However, the only purpose of search_sysfs_block() is to find the sysfs directory for a block device by device number. That can trivially be done using /sys/dev/block/$major:$minor. So just do that instead. Also make get_partition_start() explicitly Linux-only, as it has never worked anywhere else. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'include')
-rw-r--r--include/mingw/sys/sysmacros.h8
1 files changed, 1 insertions, 7 deletions
diff --git a/include/mingw/sys/sysmacros.h b/include/mingw/sys/sysmacros.h
index 18fcaaa3..a790cb2f 100644
--- a/include/mingw/sys/sysmacros.h
+++ b/include/mingw/sys/sysmacros.h
@@ -1,11 +1,5 @@
-
#pragma once
-/*
- * Fall back to Linux's definitions of makedev and major are needed.
- * The search_sysfs_block() function is highly unlikely to work on
- * non-Linux systems anyway.
- */
#ifndef makedev
#define makedev(maj, min) (((maj) << 8) + (min))
-#endif \ No newline at end of file
+#endif