Browse code

- error message fixed (displayed only if there really is an error)

Andrei Pelinescu-Onciul authored on 30/11/2003 23:51:07
Showing 1 changed files
... ...
@@ -538,6 +538,7 @@ int open_fifo_server()
538 538
 {
539 539
 	char *t;
540 540
 	struct stat filestat;
541
+	int n;
541 542
 #ifdef USE_TCP
542 543
 	int sockfd[2];
543 544
 #endif
... ...
@@ -552,17 +553,19 @@ int open_fifo_server()
552 553
 		return 1;
553 554
 	}
554 555
 	DBG("DBG: open_uac_fifo: opening fifo...\n");
555
-	if (stat(fifo, &filestat)==0){
556
+	n=stat(fifo, &filestat);
557
+	if (n==0){
556 558
 		/* FIFO exist, delete it (safer) */
557 559
 		if (unlink(fifo)<0){
558 560
 			LOG(L_ERR, "ERROR: open_fifo_server: cannot delete old fifo (%s):"
559 561
 					" %s\n", fifo, strerror(errno));
560 562
 			return -1;
561
-			}
562 563
 		}
563
-		/* create FIFO ... */
564
+	}else if (n<0 && errno!=ENOENT){
564 565
 		LOG(L_DBG, "DEBUG: open_fifo_server: FIFO stat failed: %s\n",
565 566
 			strerror(errno));
567
+	}
568
+		/* create FIFO ... */
566 569
 		if ((mkfifo(fifo, fifo_mode)<0)) {
567 570
 			LOG(L_ERR, "ERROR: open_fifo_server; can't create FIFO: "
568 571
 					"%s (mode=%d)\n",