Re: [Patch] gio-standalone build fail with suncc because retrun value in void function
Halton Huo <[email protected]>
| Newsgroups | gmane.comp.gnome.vfs.general |
|---|---|
| Message-ID | <1194419136.1171.37.camel@judo> |
Find a better way to write this patch. Use macro sun which is defined in compiler, suncc and gcc both have this. Halton. On Wed, 2007-11-07 at 14:20 +0800, Halton Huo wrote: > 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. > > _______________________________________________ > gnome-vfs-list mailing list > [email protected] > http://mail.gnome.org/mailman/listinfo/gnome-vfs-list -- Halton Huo Solaris Desktop Team, Sun Microsystems Tel: +86-10-82618200 ext. 82113/ +86-10-626732113 Fax: +86-10-62780969 eMail: [email protected] _______________________________________________ gnome-vfs-list mailing list [email protected] http://mail.gnome.org/mailman/listinfo/gnome-vfs-list
gio-02-solaris-getid.diff
(text/x-patch, 707 B)
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 defined(sun)
+ 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 defined(sun)
+ 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 &&