Re: Seg Fault on posix_getpwnam()
| From: | Gashaw Teshome | Date: | Fri, 08 Sep 2000 00:17:49 +0000 |
| Subject: | Re: Seg Fault on posix_getpwnam() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15801@lists.php.net to get a copy of this message | ||
I found the solution to my own problem. An upgrade to PHP 4.0.2 fixed
the seg faulting and now the script works as it should. Whoo Whooo (a
la Homer)!
Gash
Gashaw Teshome wrote:
>
> I have a script that seg faults when run:
>
> <?
>
> $handle=opendir("/home");
> while ($username = readdir($handle)) {
>
> $r=posix_getpwnam("$username");
> $gid=$r["gid"];
>
> if ($username != "." && $username != ".." && $gid ==
> 507) {
>
> echo "$username<br>";
> }
> }
> closedir($handle);
>
> ?>
>
> The scripts reads /home, gets the trailing path -ie, username (and no,
> this is probably not the best way to do it)- and gets the group id of
> the user. The scripts works if I substitute posix_getgrnam($username)
> but the results aren't what I need. Anyone see a problem with my script
> or is this a bug in PHP 4.0.1pl2?
>
> BTW, posix_getpwnam() works on its own. I think the while loop is
> killing it somehow.
>
> Thanks
> Gash
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net