Revision c07b32bd utils.c

View differences:

utils.c
331 331
	/* Try locking the PID file */
332 332
	int pid = 0;
333 333
	if(flock(pidfd, LOCK_EX|LOCK_NB) < 0) {
334
		fscanf(pidf, "%d", &pid);
335
		JANUS_LOG(LOG_FATAL, "Error locking PID file (lock held by PID %d?)\n", pid);
334
		if(fscanf(pidf, "%d", &pid) == 1) {
335
			JANUS_LOG(LOG_FATAL, "Error locking PID file (lock held by PID %d?)\n", pid);
336
		} else {
337
			JANUS_LOG(LOG_FATAL, "Error locking PID file (lock held by unknown PID?)\n");
338
		}
336 339
		fclose(pidf);
337 340
		return -1;
338 341
	}

Also available in: Unified diff