Richard W.M. Jones
2018-Jun-19 07:30 UTC
[Libguestfs] [PATCH nbdkit] main: Set umask to a known value and document it for plugins.
--- docs/nbdkit-plugin.pod.in | 4 ++++ src/main.c | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/docs/nbdkit-plugin.pod.in b/docs/nbdkit-plugin.pod.in index b6b2e47..22ca40e 100644 --- a/docs/nbdkit-plugin.pod.in +++ b/docs/nbdkit-plugin.pod.in @@ -302,6 +302,10 @@ and returns C<NULL>. The returned string must be freed by the caller. +=head2 umask + +All plugins will see a L<umask(2)> of C<0022>. + =head1 CALLBACKS =head2 C<.name> diff --git a/src/main.c b/src/main.c index 660d036..8d901cf 100644 --- a/src/main.c +++ b/src/main.c @@ -479,6 +479,12 @@ main (int argc, char *argv[]) exit (EXIT_FAILURE); } + /* Set the umask to a known value. This makes the behaviour of + * plugins when creating files more predictable, and also removes an + * implicit dependency on umask when calling mkstemp(3). + */ + umask (0022); + /* Initialize TLS. */ crypto_init (tls_set_on_cli); assert (tls != -1); -- 2.16.2
Eric Blake
2018-Jun-19 12:24 UTC
Re: [Libguestfs] [PATCH nbdkit] main: Set umask to a known value and document it for plugins.
On 06/19/2018 02:30 AM, Richard W.M. Jones wrote:> --- > docs/nbdkit-plugin.pod.in | 4 ++++ > src/main.c | 6 ++++++ > 2 files changed, 10 insertions(+) >LGTM -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
Seemingly Similar Threads
- [PATCH nbdkit] tls: Implement Pre-Shared Keys (PSK) authentication.
- [PATCH nbdkit] server: Use bool for types which are really booleans.
- [PATCH nbdkit 5/9 patch split 3/5] server: Move some definitions in server/internal.h to the top of the file.
- [nbdkit PATCH] main: More idiomatic use of getopt_long
- [nbdkit PATCH 3/5] api: Add nbdkit_string_intern helper