View | Details | Raw Unified | Return to bug 1740 | Differences between
and this patch

Collapse All | Expand All

(-)ssh-keygen.c (-7 / +13 lines)
Lines 1871-1883 main(int argc, char **argv) Link Here
1871
		ask_filename(pw, "Enter file in which to save the key");
1871
		ask_filename(pw, "Enter file in which to save the key");
1872
1872
1873
	/* Create ~/.ssh directory if it doesn't already exist. */
1873
	/* Create ~/.ssh directory if it doesn't already exist. */
1874
	snprintf(dotsshdir, sizeof dotsshdir, "%s/%s", pw->pw_dir, _PATH_SSH_USER_DIR);
1874
	snprintf(dotsshdir, sizeof dotsshdir, "%s/%s",
1875
	if (strstr(identity_file, dotsshdir) != NULL &&
1875
	    pw->pw_dir, _PATH_SSH_USER_DIR);
1876
	    stat(dotsshdir, &st) < 0) {
1876
	if (strstr(identity_file, dotsshdir) != NULL) {
1877
		if (mkdir(dotsshdir, 0700) < 0)
1877
		if (stat(dotsshdir, &st) < 0) {
1878
			error("Could not create directory '%s'.", dotsshdir);
1878
			if (errno != ENOENT) {
1879
		else if (!quiet)
1879
				error("Could not stat %s: %s", dotsshdir,
1880
			printf("Created directory '%s'.\n", dotsshdir);
1880
				    strerror(errno));
1881
			} else if (mkdir(dotsshdir, 0700) < 0) {
1882
				error("Could not create directory '%s': %s",
1883
				    dotsshdir, strerror(errno));
1884
			} else if (!quiet)
1885
				printf("Created directory '%s'.\n", dotsshdir);
1886
		}
1881
	}
1887
	}
1882
	/* If the file already exists, ask the user to confirm. */
1888
	/* If the file already exists, ask the user to confirm. */
1883
	if (stat(identity_file, &st) >= 0) {
1889
	if (stat(identity_file, &st) >= 0) {

Return to bug 1740