fix mknod and mknodat to accept large dev_t values
authorRich Felker <dalias@aerifal.cx>
Thu, 16 May 2013 20:27:37 +0000 (16:27 -0400)
committerRich Felker <dalias@aerifal.cx>
Thu, 16 May 2013 20:27:37 +0000 (16:27 -0400)
support for these was recently added to sysmacros.h. note that the
syscall argument is a long, despite dev_t being 64-bit, so on 32-bit
archs the high bits will be lost. it appears the high bits are just
glibc silliness and not part of the kernel api, anyway, but it's nice
that we have them there for future expansion if needed.

src/stat/mknod.c
src/stat/mknodat.c

index 90c6a1c..c319657 100644 (file)
@@ -3,8 +3,5 @@
 
 int mknod(const char *path, mode_t mode, dev_t dev)
 {
 
 int mknod(const char *path, mode_t mode, dev_t dev)
 {
-       /* since dev_t is system-specific anyway we defer to the idiotic
-        * legacy-compatible bitfield mapping of the type.. at least we've
-        * made it large enough to leave space for future expansion.. */
-       return syscall(SYS_mknod, path, mode, dev & 0xffff);
+       return syscall(SYS_mknod, path, mode, dev);
 }
 }
index 63cacd5..7c97c91 100644 (file)
@@ -3,5 +3,5 @@
 
 int mknodat(int fd, const char *path, mode_t mode, dev_t dev)
 {
 
 int mknodat(int fd, const char *path, mode_t mode, dev_t dev)
 {
-       return syscall(SYS_mknodat, fd, path, mode, dev & 0xffff);
+       return syscall(SYS_mknodat, fd, path, mode, dev);
 }
 }