diff options
Diffstat (limited to 'ssh-agent.c')
-rw-r--r-- | ssh-agent.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/ssh-agent.c b/ssh-agent.c index 9c0a583e8..55704e492 100644 --- a/ssh-agent.c +++ b/ssh-agent.c | |||
@@ -674,7 +674,9 @@ main(int ac, char **av) | |||
674 | fd_set readset, writeset; | 674 | fd_set readset, writeset; |
675 | int sock, c_flag = 0, k_flag = 0, s_flag = 0, ch; | 675 | int sock, c_flag = 0, k_flag = 0, s_flag = 0, ch; |
676 | struct sockaddr_un sunaddr; | 676 | struct sockaddr_un sunaddr; |
677 | #ifdef HAVE_SETRLIMIT | ||
677 | struct rlimit rlim; | 678 | struct rlimit rlim; |
679 | #endif | ||
678 | pid_t pid; | 680 | pid_t pid; |
679 | char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid]; | 681 | char *shell, *format, *pidstr, pidstrbuf[1 + 3 * sizeof pid]; |
680 | extern int optind; | 682 | extern int optind; |
@@ -805,12 +807,14 @@ main(int ac, char **av) | |||
805 | close(1); | 807 | close(1); |
806 | close(2); | 808 | close(2); |
807 | 809 | ||
810 | #ifdef HAVE_SETRLIMIT | ||
808 | /* deny core dumps, since memory contains unencrypted private keys */ | 811 | /* deny core dumps, since memory contains unencrypted private keys */ |
809 | rlim.rlim_cur = rlim.rlim_max = 0; | 812 | rlim.rlim_cur = rlim.rlim_max = 0; |
810 | if (setrlimit(RLIMIT_CORE, &rlim) < 0) { | 813 | if (setrlimit(RLIMIT_CORE, &rlim) < 0) { |
811 | perror("setrlimit rlimit_core failed"); | 814 | perror("setrlimit rlimit_core failed"); |
812 | cleanup_exit(1); | 815 | cleanup_exit(1); |
813 | } | 816 | } |
817 | #endif | ||
814 | if (setsid() == -1) { | 818 | if (setsid() == -1) { |
815 | perror("setsid"); | 819 | perror("setsid"); |
816 | cleanup_exit(1); | 820 | cleanup_exit(1); |