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

Collapse All | Expand All

(-)sshd.c (-1 / +27 lines)
Lines 801-806 Link Here
801
	Authctxt *authctxt;
801
	Authctxt *authctxt;
802
	Key *key;
802
	Key *key;
803
	int ret, key_used = 0;
803
	int ret, key_used = 0;
804
	char *path = NULL;
805
	struct stat st;
804
806
805
	/* Save argv. */
807
	/* Save argv. */
806
	saved_argv = av;
808
	saved_argv = av;
Lines 1020-1025 Link Here
1020
			    "world-writable.", _PATH_PRIVSEP_CHROOT_DIR);
1022
			    "world-writable.", _PATH_PRIVSEP_CHROOT_DIR);
1021
	}
1023
	}
1022
1024
1025
	/* Determine directory path to PidFile */
1026
	if (strrchr(options.pid_file, '/') != NULL) {
1027
		path = xstrdup(options.pid_file);
1028
		*(strrchr(path, '/')+1) = '\0';
1029
	} else
1030
		path = xstrdup(".");
1031
1032
	/* Check if PidFile directory (and file if is exists) is writable */
1033
	if (stat(path, &st) == -1)
1034
		error("Could not check PidFile directory `%.100s' (%s)", path,
1035
		    strerror(errno));
1036
	else if (!S_ISDIR(st.st_mode))
1037
		error("PidFile directory `%.100s' is not a directory!", path);
1038
	else if (access(path, W_OK) == -1)
1039
		error("PidFile directory `%.100s' not writable (%s)", path,
1040
		    strerror(errno));
1041
	else if (stat(options.pid_file, &st) == 0 &&
1042
	    access(options.pid_file, W_OK) == -1)
1043
		error("PidFile %.100s exists and is not writable (%s)",
1044
		    options.pid_file, strerror(errno));
1045
	xfree(path);
1046
1023
	/* Configuration looks good, so exit if in test mode. */
1047
	/* Configuration looks good, so exit if in test mode. */
1024
	if (test_flag)
1048
	if (test_flag)
1025
		exit(0);
1049
		exit(0);
Lines 1164-1170 Link Here
1164
			if (f) {
1188
			if (f) {
1165
				fprintf(f, "%ld\n", (long) getpid());
1189
				fprintf(f, "%ld\n", (long) getpid());
1166
				fclose(f);
1190
				fclose(f);
1167
			}
1191
			} else
1192
				error("Failed to write PidFile (%s)",
1193
				    strerror(errno));
1168
		}
1194
		}
1169
1195
1170
		/* setup fd set for listen */
1196
		/* setup fd set for listen */

Return to bug 606