Richard W.M. Jones
2009-Nov-25 15:03 UTC
[Libguestfs] [PATCH] daemon/Win32: Windows replacement for umask.
-- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones New in Fedora 11: Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 70 libraries supprt'd http://fedoraproject.org/wiki/MinGW http://www.annexia.org/fedora_mingw -------------- next part -------------->From 8880aaad8235f35b29de76784b63db70e2b10171 Mon Sep 17 00:00:00 2001From: Richard Jones <rjones at redhat.com> Date: Wed, 25 Nov 2009 14:56:42 +0000 Subject: [PATCH 5/7] daemon/Win32: Windows replacement for umask. --- daemon/guestfsd.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c index 64cf87f..40b3c2f 100644 --- a/daemon/guestfsd.c +++ b/daemon/guestfsd.c @@ -182,8 +182,16 @@ main (int argc, char *argv[]) setenv ("SHELL", "/bin/sh", 1); setenv ("LC_ALL", "C", 1); +#ifndef WIN32 /* We document that umask defaults to 022 (it should be this anyway). */ umask (022); +#else + /* This is the default for Windows anyway. It's not even clear if + * Windows ever uses this -- the MSDN documentation for the function + * contains obvious errors. + */ + _umask (0); +#endif /* Get the vmchannel string. * -- 1.6.5.2
Jim Meyering
2009-Nov-25 17:49 UTC
[Libguestfs] [PATCH] daemon/Win32: Windows replacement for umask.
Richard W.M. Jones wrote:> Subject: [PATCH 5/7] daemon/Win32: Windows replacement for umask. > > --- > daemon/guestfsd.c | 8 ++++++++ > 1 files changed, 8 insertions(+), 0 deletions(-) > > diff --git a/daemon/guestfsd.c b/daemon/guestfsd.c > index 64cf87f..40b3c2f 100644 > --- a/daemon/guestfsd.c > +++ b/daemon/guestfsd.c > @@ -182,8 +182,16 @@ main (int argc, char *argv[]) > setenv ("SHELL", "/bin/sh", 1); > setenv ("LC_ALL", "C", 1); > > +#ifndef WIN32 > /* We document that umask defaults to 022 (it should be this anyway). */ > umask (022); > +#else > + /* This is the default for Windows anyway. It's not even clear if > + * Windows ever uses this -- the MSDN documentation for the function > + * contains obvious errors. > + */ > + _umask (0); > +#endifSame idea here: #ifdef WIN32 static inline mode_t umask (mode_t mode) { _umask (0); } #endif
Reasonably Related Threads
- [PATCH] daemon/Win32: Don't bother blocking SIGPIPE on Win32.
- [PATCH] daemon/RHEL: Choose correct udev settle script.
- [PATCH] daemon/Win32: Windows can't daemonize.
- SFTP subsystem and umask
- [PATCH] daemon: Move creating of LVM_SYSTEM_DIR into the appliance/init script.