diff options
author | Richard Jones <rjones@redhat.com> | 2010-04-17 13:07:56 +0100 |
---|---|---|
committer | Richard Jones <rjones@redhat.com> | 2010-04-17 13:07:56 +0100 |
commit | 4e5327187d6474e81241dd2b6f5418be2387a0cb (patch) | |
tree | 9f40c31a4c5d9256bf4a725578fca4dc35643603 /daemon/umask.c | |
parent | 116d497c68c2e57f6e92abf8834112a794a145f0 (diff) | |
download | libguestfs-4e5327187d6474e81241dd2b6f5418be2387a0cb.tar.gz libguestfs-4e5327187d6474e81241dd2b6f5418be2387a0cb.tar.xz libguestfs-4e5327187d6474e81241dd2b6f5418be2387a0cb.zip |
New API: get-umask, returns the current umask (RHBZ#582891).
Diffstat (limited to 'daemon/umask.c')
-rw-r--r-- | daemon/umask.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/daemon/umask.c b/daemon/umask.c index 22d2cc93..a9ddeab0 100644 --- a/daemon/umask.c +++ b/daemon/umask.c @@ -44,3 +44,20 @@ do_umask (int mask) return r; } + +int +do_get_umask (void) +{ + int r; + + r = umask (022); + if (r == -1) { + reply_with_perror ("umask"); + return -1; + } + + /* Restore the umask, since the call above corrupted it. */ + umask (r); + + return r; +} |