Subversion Repositories public

Rev

Rev 71 | Rev 100 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 71 Rev 73
Line 24... Line 24...
24
#include <errno.h>
24
#include <errno.h>
25
#include <signal.h>
25
#include <signal.h>
26
26
27
#include "appinst.h"
27
#include "appinst.h"
28
28
-
 
29
/// Lockfile permissions (currently 0644)
-
 
30
#define APPLOCK_PERM (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)
29
 
31
 
30
32
31
AppInstance::AppInstance(const std::string& rName, const std::string& rBase)
33
AppInstance::AppInstance(const std::string& rName, const std::string& rBase)
32
: m_fLocked(false)
34
: m_fLocked(false)
33
{
35
{
Line 48... Line 50...
48
  } catch (AppInstException e) {}
50
  } catch (AppInstException e) {}
49
}
51
}
50
52
51
bool AppInstance::DoLock()
53
bool AppInstance::DoLock()
52
{
54
{
53
  int fd = open(m_path.c_str(), O_WRONLY | O_CREAT | O_EXCL, S_IRUSR | S_IWUSR);
55
  int fd = open(m_path.c_str(), O_WRONLY | O_CREAT | O_EXCL, APPLOCK_PERM);
54
  if (fd != -1) {
56
  if (fd != -1) {
55
    FILE* f = fdopen(fd, "w");
57
    FILE* f = fdopen(fd, "w");
56
    if (f == NULL) {
58
    if (f == NULL) {
57
      AppInstException e(errno);
59
      AppInstException e(errno);
58
      close(fd);
60
      close(fd);