Skip to content

Commit 2395f5b

Browse files
committed
devices: Include sys/sysmacros.h for major() and minor()
Building the source on Debian sid/unstable with libc6 2.31-5 and UUID support (default) results in the build failure below. CC tiny_initramfs-devices.o CC tiny_initramfs-util.o devices.c: In function 'scan_devices': devices.c:290:15: warning: implicit declaration of function 'major' [-Wimplicit-function-declaration] 290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) { | ^~~~~ devices.c:290:33: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) { | ^~ devices.c:290:43: warning: implicit declaration of function 'minor' [-Wimplicit-function-declaration] 290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) { | ^~~~~ devices.c:290:61: warning: comparison of integer expressions of different signedness: 'int' and 'unsigned int' [-Wsign-compare] 290 | if (major(st.st_rdev) == maj && minor(st.st_rdev) == min) { | ^~ CCLD tiny_initramfs /usr/bin/ld: tiny_initramfs-devices.o: in function `scan_devices': devices.c:(.text+0x520): undefined reference to `major' /usr/bin/ld: devices.c:(.text+0x539): undefined reference to `minor' collect2: error: ld returned 1 exit status make[1]: *** [Makefile:398: tiny_initramfs] Error 1 Explicitly include the header `sys/sysmacros.h`, where `major()` and `minor()` are defined. Resolves: #4
1 parent e593718 commit 2395f5b

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

devices.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "tiny_initramfs.h"
2424

2525
#include <sys/time.h>
26+
#include <sys/sysmacros.h>
2627
#include <time.h>
2728
#include <errno.h>
2829
#include <string.h>

0 commit comments

Comments
 (0)