[sane-devel] [sane-commit] CVS update of sane-backends (3 files)

Julien BLACHE jb at jblache.org
Sat Dec 6 17:10:37 UTC 2008


Nicolas Martin <nicolas.martin at freesurf.fr> wrote:

Hi,

>   struct passwd *uid;
>   uid = getpwuid(geteuid());
>   printf("user=%s\n", uid->pw_name);

> Prints my username correctly. Also prints root if runned with sudo ;-)

Yep, use getuid() instead of geteuid() if you want to avoid that.

Also, you want some error checking in there... :)

JB.

-- 
Julien BLACHE                                   <http://www.jblache.org> 
<jb at jblache.org>                                  GPG KeyID 0xF5D65169



More information about the sane-devel mailing list