diff options
author | Karel Zak | 2006-12-07 00:25:37 +0100 |
---|---|---|
committer | Karel Zak | 2006-12-07 00:25:37 +0100 |
commit | 5c36a0eb7cdb0360f9afd5d747c321f423b35984 (patch) | |
tree | 147599a77eaff2b5fbc0d389e89d2b51602326c0 /mount/getusername.c | |
parent | Imported from util-linux-2.8 tarball. (diff) | |
download | kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.tar.gz kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.tar.xz kernel-qcow2-util-linux-5c36a0eb7cdb0360f9afd5d747c321f423b35984.zip |
Imported from util-linux-2.9i tarball.
Diffstat (limited to 'mount/getusername.c')
-rw-r--r-- | mount/getusername.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/mount/getusername.c b/mount/getusername.c new file mode 100644 index 000000000..9835768ca --- /dev/null +++ b/mount/getusername.c @@ -0,0 +1,14 @@ +#include <unistd.h> +#include <pwd.h> +#include <sys/types.h> +#include "getusername.h" + +char * +getusername() { + char *user = 0; + struct passwd *pw = getpwuid(getuid()); + + if (pw) + user = pw->pw_name; + return user; +} |