]> granicus.if.org Git - php/commitdiff
MFH: check the return value of getgroups() for -1 (coverity issue #390)
authorAntony Dovgal <tony2001@php.net>
Fri, 21 Sep 2007 14:05:18 +0000 (14:05 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 21 Sep 2007 14:05:18 +0000 (14:05 +0000)
ext/standard/filestat.c

index 0340f86afced9badc258c9df3e322f0d8ab51e16..cfc364d2f4512859149b151f7e8602df25680e4e 100644 (file)
@@ -821,7 +821,7 @@ PHPAPI void php_stat(const char *filename, php_stat_len filename_length, int typ
                        gid_t *gids;
 
                        groups = getgroups(0, NULL);
-                       if(groups) {
+                       if(groups > 0) {
                                gids=(gid_t *)safe_emalloc(groups, sizeof(gid_t), 0);
                                n=getgroups(groups, gids);
                                for(i=0;i<n;i++){