summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid M. Syzdek <david@syzdek.net>2009-03-06 14:03:40 -0900
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-03-07 12:24:05 +0100
commitf325df1b4578ec6fa0ef2a8b824f93439fcce816 (patch)
tree673ddc3219bb8dfc1469ba38fa56055b6e0cbeda
parent3f8c823a283afa6d9b3be3ef140cbd63676a82f9 (diff)
downloadperl-f325df1b4578ec6fa0ef2a8b824f93439fcce816.tar.gz
Fixing the cast for the result of (getgrent())->gr_gid
The gr_gid member of struct group is being cast as an int even if system uses an unsigned int. This patch tests for the use of an unsigned int for the gr_gid member and casts the value as appropiate. Created with Arthur Corliss <corliss@corliss@digitalmages.com>. Signed-off-by: David M. Syzdek <david@syzdek.net>
-rw-r--r--pp_sys.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/pp_sys.c b/pp_sys.c
index 6bfdf35a77..f516e3332d 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -5328,7 +5328,11 @@ PP(pp_ggrent)
PUSHs(sv);
if (grent) {
if (which == OP_GGRNAM)
+#if Gid_t_sign <= 0
sv_setiv(sv, (IV)grent->gr_gid);
+#else
+ sv_setuv(sv, (UV)grent->gr_gid);
+#endif
else
sv_setpv(sv, grent->gr_name);
}
@@ -5344,7 +5348,11 @@ PP(pp_ggrent)
PUSHs(sv_mortalcopy(&PL_sv_no));
#endif
+#if Gid_t_sign <= 0
mPUSHi(grent->gr_gid);
+#else
+ mPUSHu(grent->gr_gid);
+#endif
#if !(defined(_CRAYMPP) && defined(USE_REENTRANT_API))
/* In UNICOS/mk (_CRAYMPP) the multithreading