summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrrelyea <rrelyea@fba4d07e-fe0f-4d7f-8147-e0026e666dc0>2007-08-15 00:34:17 +0000
committerrrelyea <rrelyea@fba4d07e-fe0f-4d7f-8147-e0026e666dc0>2007-08-15 00:34:17 +0000
commit3d9c3cde5d5086bb738cadb652644e04610df3ad (patch)
tree6a0e098af6af838818bdc9cda0b3689801c3dd06 /src
parent618345fa24565afa27e580f932641ea6edbb197e (diff)
Use a less obscure name for the cache file.
Don't try to initialize the file if we couldn't open it. git-svn-id: http://svn.fedorahosted.org/svn/coolkey/trunk@68 fba4d07e-fe0f-4d7f-8147-e0026e666dc0
Diffstat (limited to 'src')
-rw-r--r--src/coolkey/machdep.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/coolkey/machdep.cpp b/src/coolkey/machdep.cpp
index d7ce38e..21c73cf 100644
--- a/src/coolkey/machdep.cpp
+++ b/src/coolkey/machdep.cpp
@@ -195,10 +195,10 @@ void OSSleep(int time)
#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 @@ SHMem::initSegment(const char *name, int size, bool &init)
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 @@ SHMem::initSegment(const char *name, int size, bool &init)
}
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;