diff options
author | Andreas Schneider <asn@cryptomilk.org> | 2015-05-05 10:42:36 +0200 |
---|---|---|
committer | Andreas Schneider <asn@cryptomilk.org> | 2015-05-05 11:27:09 +0200 |
commit | e4e3b3052fa6050a796796e22a0c4b52cb7e0835 (patch) | |
tree | 41c0bcfb4d240ceb26209e8fc6b58544ee1ae82a /tests/unittests | |
parent | 96882cc58cc36f79600a54263b7327b1ce88f99e (diff) | |
download | libssh-e4e3b3052fa6050a796796e22a0c4b52cb7e0835.tar.gz libssh-e4e3b3052fa6050a796796e22a0c4b52cb7e0835.tar.xz libssh-e4e3b3052fa6050a796796e22a0c4b52cb7e0835.zip |
tests: Apply umask before calling mkstemp()
CID: #978660
Signed-off-by: Andreas Schneider <asn@cryptomilk.org>
Diffstat (limited to 'tests/unittests')
-rw-r--r-- | tests/unittests/torture_server_x11.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tests/unittests/torture_server_x11.c b/tests/unittests/torture_server_x11.c index 0b86c692..b990b587 100644 --- a/tests/unittests/torture_server_x11.c +++ b/tests/unittests/torture_server_x11.c @@ -3,6 +3,8 @@ #include <errno.h> #include <pthread.h> #include <stdlib.h> +#include <sys/types.h> +#include <sys/stat.h> #include <libssh/libssh.h> #include "torture.h" @@ -18,13 +20,16 @@ struct hostkey_state { static void setup(void **state) { struct hostkey_state *h; + mode_t mask; h = malloc(sizeof(struct hostkey_state)); assert_non_null(h); h->hostkey_path = strdup("/tmp/libssh_hostkey_XXXXXX"); + mask = umask(S_IRWXO | S_IRWXG); h->fd = mkstemp(h->hostkey_path); + umask(mask); assert_return_code(h->fd, errno); close(h->fd); |