[Fedora-directory-commits] coolkey/src/coolkey machdep.cpp,1.5,1.6

Robert Relyea (rrelyea) fedora-directory-commits at redhat.com
Wed Aug 15 00:34:19 UTC 2007


Author: rrelyea

Update of /cvs/dirsec/coolkey/src/coolkey
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv29424

Modified Files:
	machdep.cpp 
Log Message:


Use a less obscure name for the cache file.
Don't try to initialize the file if we couldn't open it.



Index: machdep.cpp
===================================================================
RCS file: /cvs/dirsec/coolkey/src/coolkey/machdep.cpp,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- machdep.cpp	14 Aug 2007 23:04:08 -0000	1.5
+++ machdep.cpp	15 Aug 2007 00:34:17 -0000	1.6
@@ -195,10 +195,10 @@
 
 #ifdef FULL_CLEANUP
 #define RESERVED_OFFSET 256
-#define MEMSEGPATH BASEPATH"/pk11ipc"
+#define MEMSEGPATH BASEPATH"/coolkey-lock"
 #else 
 #define RESERVED_OFFSET 0
-#define MEMSEGPATH BASEPATH"/pk11ipc1"
+#define MEMSEGPATH BASEPATH"/coolkey"
 #endif
 
 struct SHMemData {
@@ -273,10 +273,7 @@
 
     shmemData->fd = open(shmemData->path, 
 		O_CREAT|O_RDWR|O_EXCL|O_APPEND|O_EXLOCK, mode);
-    if ((shmemData->fd  < 0) && errno == EEXIST) {
-	needInit = false;
-	shmemData->fd = open(shmemData->path,O_RDWR|O_EXLOCK|O_NOFOLLOW, mode);
-    }  else {
+    if (shmemData->fd >= 0) {
 	char *buf;
 	int len = size+RESERVED_OFFSET;
 
@@ -291,6 +288,9 @@
 	}
 	write(shmemData->fd,buf,len);
 	free(buf);
+    } else if (errno == EEXIST) {
+	needInit = false;
+	shmemData->fd = open(shmemData->path,O_RDWR|O_EXLOCK|O_NOFOLLOW, mode);
     }
     if (shmemData->fd < 0) {
 	delete shmemData;




More information about the Fedora-directory-commits mailing list