Mailinglist Archive: yast-commit (953 mails)

< Previous Next >
[yast-commit] r49610 - /trunk/storage/libstorage/src/Lock.cc
  • From: aschnell@xxxxxxxxxxxxxxxx
  • Date: Sun, 03 Aug 2008 17:40:59 -0000
  • Message-id: <20080803174059.A0A942E5D5@xxxxxxxxxxxxxxxx>
Author: aschnell
Date: Sun Aug 3 19:40:59 2008
New Revision: 49610

URL: http://svn.opensuse.org/viewcvs/yast?rev=49610&view=rev
Log:
- better location for lock-file

Modified:
trunk/storage/libstorage/src/Lock.cc

Modified: trunk/storage/libstorage/src/Lock.cc
URL:
http://svn.opensuse.org/viewcvs/yast/trunk/storage/libstorage/src/Lock.cc?rev=49610&r1=49609&r2=49610&view=diff
==============================================================================
--- trunk/storage/libstorage/src/Lock.cc (original)
+++ trunk/storage/libstorage/src/Lock.cc Sun Aug 3 19:40:59 2008
@@ -33,8 +33,13 @@
{
y2mil("getting " << (readonly ? "read-only" : "read-write") << " lock");

- // TODO filename
- fd = open("/tmp/lock-test", (readonly ? O_RDONLY : O_WRONLY) | O_CREAT,
+ if (mkdir("/var/lock/libstorage", 0622) < 0)
+ {
+ // Creating directory failed. Not fatal (should already exist).
+ y2deb("creating directory for lock-file failed: " <<
strerror(errno));
+ }
+
+ fd = open("/var/lock/libstorage/lock", (readonly ? O_RDONLY : O_WRONLY)
| O_CREAT,
S_IRUSR | S_IWUSR);
if (fd < 0)
{
@@ -76,6 +81,9 @@
{
y2mil("releasing lock");
close(fd);
+
+ // Do not bother deleting lock-file. This is difficult if there are
+ // several read-only locks.
}

}

--
To unsubscribe, e-mail: yast-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: yast-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages