]> andersk Git - openssh.git/blobdiff - ssh-add.c
- stevesk@cvs.openbsd.org 2006/02/20 17:02:44
[openssh.git] / ssh-add.c
index a3428769c9bdf0f17f2cc660b6451faef7747a25..8bfc401e8dae3ea230dcae76e9997fe33c93a337 100644 (file)
--- a/ssh-add.c
+++ b/ssh-add.c
  */
 
 #include "includes.h"
-RCSID("$OpenBSD: ssh-add.c,v 1.72 2005/07/17 07:17:55 djm Exp $");
+RCSID("$OpenBSD: ssh-add.c,v 1.75 2006/02/20 17:19:54 stevesk Exp $");
+
+#include <sys/types.h>
+#include <sys/stat.h>
 
 #include <openssl/evp.h>
 
@@ -312,6 +315,9 @@ main(int argc, char **argv)
        char *sc_reader_id = NULL;
        int i, ch, deleting = 0, ret = 0;
 
+       /* Ensure that fds 0, 1 and 2 are open or directed to /dev/null */
+       sanitise_stdfd();
+
        __progname = ssh_get_progname(argv[0]);
        init_rng();
        seed_rng();
@@ -321,7 +327,8 @@ main(int argc, char **argv)
        /* At first, get a connection to the authentication agent. */
        ac = ssh_get_authentication_connection();
        if (ac == NULL) {
-               fprintf(stderr, "Could not open a connection to your authentication agent.\n");
+               fprintf(stderr,
+                   "Could not open a connection to your authentication agent.\n");
                exit(2);
        }
        while ((ch = getopt(argc, argv, "lLcdDxXe:s:t:")) != -1) {
This page took 0.032744 seconds and 4 git commands to generate.