diff options
author | Ben Cohen <ben-cohen@users.noreply.github.com> | 2017-09-14 17:49:51 +0100 |
---|---|---|
committer | metalefty <meta@vmeta.jp> | 2017-10-17 14:34:25 +0900 |
commit | a2b008f63e75835a3b3d2f0ff7deb95586711fd5 (patch) | |
tree | 4c8caa352578645f35591366a71c7ed790db3fa0 /xrdpapi/xrdp-ssh-agent.c | |
parent | 6fb3fcfc66ccff5e436285fca04041d82c310ea4 (diff) | |
download | xrdp-proprietary-a2b008f63e75835a3b3d2f0ff7deb95586711fd5.tar.gz xrdp-proprietary-a2b008f63e75835a3b3d2f0ff7deb95586711fd5.zip |
xrdp-ssh-agent.c: Fix braces for coding style
Diffstat (limited to 'xrdpapi/xrdp-ssh-agent.c')
-rw-r--r-- | xrdpapi/xrdp-ssh-agent.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/xrdpapi/xrdp-ssh-agent.c b/xrdpapi/xrdp-ssh-agent.c index 0e80bb6b..1e62aeb8 100644 --- a/xrdpapi/xrdp-ssh-agent.c +++ b/xrdpapi/xrdp-ssh-agent.c @@ -122,10 +122,13 @@ mktemp_proto(char *s, size_t len) const char *tmpdir; int r; - if ((tmpdir = getenv("TMPDIR")) != NULL) { + if ((tmpdir = getenv("TMPDIR")) != NULL) + { r = snprintf(s, len, "%s/ssh-XXXXXXXXXXXX", tmpdir); if (r > 0 && (size_t)r < len) + { return; + } } r = snprintf(s, len, "/tmp/ssh-XXXXXXXXXXXX"); if (r < 0 || (size_t)r >= len) @@ -144,7 +147,8 @@ setup_ssh_agent(struct sockaddr_un *addr) /* Create private directory for agent socket */ mktemp_proto(socket_dir, sizeof(socket_dir)); - if (mkdtemp(socket_dir) == NULL) { + if (mkdtemp(socket_dir) == NULL) + { perror("mkdtemp: private socket dir"); exit(1); } @@ -215,19 +219,23 @@ setup_ssh_agent(struct sockaddr_un *addr) (void)chdir("/"); int devnullfd; - if ((devnullfd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + if ((devnullfd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) + { /* XXX might close listen socket */ (void)dup2(devnullfd, STDIN_FILENO); (void)dup2(devnullfd, STDOUT_FILENO); (void)dup2(devnullfd, STDERR_FILENO); if (devnullfd > 2) + { close(devnullfd); + } } /* deny core dumps, since memory contains unencrypted private keys */ struct rlimit rlim; rlim.rlim_cur = rlim.rlim_max = 0; - if (setrlimit(RLIMIT_CORE, &rlim) < 0) { + if (setrlimit(RLIMIT_CORE, &rlim) < 0) + { fprintf(stderr, "setrlimit RLIMIT_CORE: %s", strerror(errno)); exit(1); } |