vishalmishra434 / rpms / openssh

Forked from rpms/openssh a month ago
Clone
Jan F. Chadima bd929b
diff -up openssh-5.5p1/ssh-keygen.c.staterr openssh-5.5p1/ssh-keygen.c
Jan F. Chadima bd929b
--- openssh-5.5p1/ssh-keygen.c.staterr	2010-05-04 09:01:14.000000000 +0200
Jan F. Chadima bd929b
+++ openssh-5.5p1/ssh-keygen.c	2010-05-04 09:03:32.000000000 +0200
Jan F. Chadima bd929b
@@ -1831,13 +1831,19 @@ main(int argc, char **argv)
Jan F. Chadima bd929b
 		ask_filename(pw, "Enter file in which to save the key");
Jan F. Chadima bd929b
 
Jan F. Chadima bd929b
 	/* Create ~/.ssh directory if it doesn't already exist. */
Jan F. Chadima bd929b
-	snprintf(dotsshdir, sizeof dotsshdir, "%s/%s", pw->pw_dir, _PATH_SSH_USER_DIR);
Jan F. Chadima bd929b
-	if (strstr(identity_file, dotsshdir) != NULL &&
Jan F. Chadima bd929b
-	    stat(dotsshdir, &st) < 0) {
Jan F. Chadima bd929b
-		if (mkdir(dotsshdir, 0700) < 0)
Jan F. Chadima bd929b
-			error("Could not create directory '%s'.", dotsshdir);
Jan F. Chadima bd929b
-		else if (!quiet)
Jan F. Chadima bd929b
-			printf("Created directory '%s'.\n", dotsshdir);
Jan F. Chadima bd929b
+	snprintf(dotsshdir, sizeof dotsshdir, "%s/%s",
Jan F. Chadima bd929b
+	    pw->pw_dir, _PATH_SSH_USER_DIR);
Jan F. Chadima bd929b
+	if (strstr(identity_file, dotsshdir) != NULL) {
Jan F. Chadima bd929b
+		if (stat(dotsshdir, &st) < 0) {
Jan F. Chadima bd929b
+			if (errno != ENOENT) {
Jan F. Chadima bd929b
+				error("Could not stat %s: %s", dotsshdir,
Jan F. Chadima bd929b
+				    strerror(errno));
Jan F. Chadima bd929b
+			} else if (mkdir(dotsshdir, 0700) < 0) {
Jan F. Chadima bd929b
+				error("Could not create directory '%s': %s",
Jan F. Chadima bd929b
+				    dotsshdir, strerror(errno));
Jan F. Chadima bd929b
+			} else if (!quiet)
Jan F. Chadima bd929b
+				printf("Created directory '%s'.\n", dotsshdir);
Jan F. Chadima bd929b
+		}
Jan F. Chadima bd929b
 	}
Jan F. Chadima bd929b
 	/* If the file already exists, ask the user to confirm. */
Jan F. Chadima bd929b
 	if (!overwrite && stat(identity_file, &st) >= 0) {