Ok, I modified the loop. Now it will gracefully fail if get_user_name() returns something that isn't in /etc/passwd:

boolfound = false;
unowned Posix.Passwdpasswd;
Posix.setpwent();
while(null!= (passwd = Posix.getpwent())) {
if(passwd.pw_name == GLib.Environment.get_user_name()) {
found = true;
cmd += passwd.pw_shell;
break;
}
}
if(!found) {
cmd += "/bin/sh";
}
Posix.endpwent();

--
Nos leemos
                         RASTER    (Linux user #228804)
rasters...@gmail.com                 https://www.rastersoft.com

Reply via email to