[Patch] gio-standalone build fail with suncc because retrun value in void function



Hi Alexl,

When I try to build gio-standalone trunk code on Solaris with suncc, I get build fail with following message:

/ws/onnv-tools-prc/SUNWspro/SS11/bin/cc -DHAVE_CONFIG_H -I. -I.. -I.. -I.. -DGIO_MODULE_DIR=\"/export/home/halton/work/dist//lib/gio/modules\" -D_REENTRANT -D_PTHREADS -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -DG_LOG_DOMAIN=\"GIO\" -DG_DISABLE_DEPRECATED -DDBUS_API_SUBJECT_TO_CHANGE -g -c glocalfileinfo.c  -KPIC -DPIC -o .libs/glocalfileinfo.o
"glocalfileinfo.c", line 975: prototype mismatch: 5 args passed, 4 expected
"glocalfileinfo.c", line 1056: prototype mismatch: 5 args passed, 4 expected

It is because getgrgid_r is differrent between Linux and Solaris.

On Solaris:
struct passwd *getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer, int  buflen);

On Linux:
int getpwuid_r(uid_t uid, struct passwd *pwd, char *buffer,
       size_t bufsize, struct passwd **result)

getgrgid_r have similar difference. The patch is attached.

Halton.

Index: trunk/configure.ac
===================================================================
--- trunk/configure.ac	(revision 722)
+++ trunk/configure.ac	(working copy)
@@ -89,6 +89,9 @@
   *-*-mingw*)
     glib_native_win32=yes
     ;;
+  *solaris*)
+    AC_DEFINE(ON_SOLARIS, 1, [Define to 1 if os is solaris])
+    ;;
   *)
     glib_native_win32=no
     ;;
Index: trunk/gio/glocalfileinfo.c
===================================================================
--- trunk/gio/glocalfileinfo.c	(revision 722)
+++ trunk/gio/glocalfileinfo.c	(working copy)
@@ -972,7 +972,11 @@
 
   data = g_new0 (UidData, 1);
 
+#if ON_SOLARIS
+  pwbufp = getpwuid_r (uid, &pwbuf, buffer, sizeof(buffer));
+#else
   getpwuid_r (uid, &pwbuf, buffer, sizeof(buffer), &pwbufp);
+#endif
 
   if (pwbufp != NULL)
     {
@@ -1053,7 +1057,11 @@
   if (name)
     return name;
 
+#if ON_SOLARIS
+  gbufp = getgrgid_r (gid, &gbuf, buffer, sizeof(buffer));
+#else
   getgrgid_r (gid, &gbuf, buffer, sizeof(buffer), &gbufp);
+#endif
 
   if (gbufp != NULL &&
       gbufp->gr_name != NULL &&


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]