---
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