Check-in [5d36185bbb]
Overview
Comment:Updated to become a daemon earlier so that opening "/dev/null" works
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 5d36185bbbfce0cf23dbed3922fadf77f8c28afb
User & Date: rkeene on 2014-02-08 06:01:06
Other Links: manifest | tags
Context
2014-02-08
06:08
Added support for a --version option check-in: aed0816914 user: rkeene tags: trunk
06:01
Updated to become a daemon earlier so that opening "/dev/null" works check-in: 5d36185bbb user: rkeene tags: trunk
05:33
Updated to send correct mime type for served index.html page check-in: d78a7b98bf user: rkeene tags: trunk
Changes

Modified filed.c from [521ac713bc] to [c245fb8d4f].

1114
1115
1116
1117
1118
1119
1120










1121
1122
1123
1124
1125
1126
1127
	/* Create listening socket */
	fd = filed_listen(bind_addr, port);
	if (fd < 0) {
		perror("filed_listen");

		return(1);
	}











	/* Chroot, if appropriate */
	if (newroot) {
		chdir_ret = chdir(newroot);
		if (chdir_ret != 0) {
			perror("chdir");








>
>
>
>
>
>
>
>
>
>







1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
	/* Create listening socket */
	fd = filed_listen(bind_addr, port);
	if (fd < 0) {
		perror("filed_listen");

		return(1);
	}

	/* Become a daemon */
	if (daemon_enabled) {
		init_ret = filed_daemonize();
		if (init_ret != 0) {
			perror("filed_daemonize");

			return(6);
		}
	}

	/* Chroot, if appropriate */
	if (newroot) {
		chdir_ret = chdir(newroot);
		if (chdir_ret != 0) {
			perror("chdir");

1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
		if (setuid_ret != 0) {
			perror("setuid");

			return(1);
		}
	}

	/* Become a daemon */
	if (daemon_enabled) {
		filed_daemonize();
	}

	/* Initialize */
	init_ret = filed_init(cache_size);
	if (init_ret != 0) {
		perror("filed_init");

		return(3);
	}







<
<
<
<
<







1152
1153
1154
1155
1156
1157
1158





1159
1160
1161
1162
1163
1164
1165
		if (setuid_ret != 0) {
			perror("setuid");

			return(1);
		}
	}






	/* Initialize */
	init_ret = filed_init(cache_size);
	if (init_ret != 0) {
		perror("filed_init");

		return(3);
	}
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
	}

	/* Create worker threads */
	init_ret = filed_worker_threads_init(fd, thread_count);
	if (init_ret != 0) {
		perror("filed_worker_threads_init");

		return(4);
	}

	/* Wait for threads to exit */
	/* XXX:TODO: Monitor thread usage */
	while (1) {
		sleep(60);
	}

	/* Return in failure */
	return(2);
}







|











1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
	}

	/* Create worker threads */
	init_ret = filed_worker_threads_init(fd, thread_count);
	if (init_ret != 0) {
		perror("filed_worker_threads_init");

		return(5);
	}

	/* Wait for threads to exit */
	/* XXX:TODO: Monitor thread usage */
	while (1) {
		sleep(60);
	}

	/* Return in failure */
	return(2);
}