Просмотр исходного кода

Don't let corosync-keygen fail if /etc/ais already exists

git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@2207 fd59a12c-fef9-0310-b244-a6a79926bd2f
Christine Caulfield 16 лет назад
Родитель
Сommit
3855b4285e
1 измененных файлов с 5 добавлено и 2 удалено
  1. 5 2
      tools/corosync-keygen.c

+ 5 - 2
tools/corosync-keygen.c

@@ -38,6 +38,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 #include <fcntl.h>
+#include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
@@ -57,8 +58,10 @@ int main (void) {
 		exit (1);
 	}
 	if (mkdir (SYSCONFDIR "/ais", 0700)) {
-		perror ("Failed to create directory: " SYSCONFDIR "/ais");
-		exit (1);
+		if (errno != EEXIST) {
+			perror ("Failed to create directory: " SYSCONFDIR "/ais");
+			exit (1);
+		}
 	}
 
 	printf ("Gathering %lu bits for key from /dev/random.\n", (unsigned long)(sizeof (key) * 8));