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