IgnorantGuru / udevil

Mount without password
http://ignorantguru.github.com/udevil/
GNU General Public License v3.0
129 stars 30 forks source link

[build] Add 'sys/stat.h' into 'src/device-info.h' #59

Closed vp1981 closed 9 years ago

vp1981 commented 9 years ago

Hello, please consider the following patch:

diff --git a/src/device-info.h b/src/device-info.h
index 6cb3683..ddac24c 100644
--- a/src/device-info.h
+++ b/src/device-info.h
@@ -18,7 +18,8 @@
 // intltool
 #include <glib/gi18n.h>

-
+// stat
+#include <sys/stat.h>

 typedef struct device_t  {
     struct udev_device *udevice;

(gist: https://gist.github.com/vp1981/9b99f400472caf1d55df)

Rationale: as 'device-info.c' uses 'stat' function then 'device-info.h' must explicitly include 'sys/stat.h' header.

ghost commented 9 years ago

I can confirm this. Gentoo bug 552072 indicates that GCC 5.x will error out with output similar to:

device-info.c: In function 'info_mount_points':
device-info.c:943:33: error: implicit declaration of function 'stat' [-Werror=implicit-function-declaration]
                                 stat( mount_source, &statbuf ) == 0 &&
                                 ^
device-info.c:944:33: error: implicit declaration of function 'S_ISBLK' [-Werror=implicit-function-declaration]
                                 S_ISBLK( statbuf.st_mode ) )
                                 ^

I've applied this patch downstream and confirm that it works.

IgnorantGuru commented 9 years ago

Thanks - merged into next.