~ubuntu-branches/ubuntu/utopic/pacemaker/utopic-proposed

« back to all changes in this revision

Viewing changes to debian/patches/fix_dir_creation.patch

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2013-07-16 16:40:24 UTC
  • mfrom: (1.1.11) (2.2.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130716164024-lvwrf4xivk1wdr3c
Tags: 1.1.9+git20130321-1ubuntu1
* Resync from debian expiremental.
* debian/control:
  - Use lower version for Build-Depends on libcorosync-dev
    and libqb-dev.
  - Build-Depends on libcfg-dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
diff --git a/mcp/pacemaker.c b/mcp/pacemaker.c
 
2
index cfa762e..6cc64c5 100644
 
3
--- a/mcp/pacemaker.c
 
4
+++ b/mcp/pacemaker.c
 
5
@@ -631,6 +631,16 @@ struct qb_ipcs_service_handlers ipc_callbacks =
 
6
 };
 
7
 /* *INDENT-ON* */
 
8
 
 
9
+static void
 
10
+mcp_chown(const char *path, uid_t uid, gid_t gid)
 
11
+{
 
12
+    int rc = chown(path, uid, gid);
 
13
+    if(rc < 0) {
 
14
+        crm_warn("Cannot change the ownership of %s to user %s and gid %d: %s",
 
15
+                 path, CRM_DAEMON_USER, gid, pcmk_strerror(errno));
 
16
+    }
 
17
+}
 
18
+
 
19
 int
 
20
 main(int argc, char **argv)
 
21
 {
 
22
@@ -775,20 +785,30 @@ struct qb_ipcs_service_handlers ipc_callbacks =
 
23
     }
 
24
 
 
25
     mkdir(CRM_STATE_DIR, 0750);
 
26
-    rc = chown(CRM_STATE_DIR, pcmk_uid, pcmk_gid);
 
27
-    if(rc < 0) {
 
28
-        crm_warn("Cannot change the ownership of %s to user %s and gid %d",
 
29
-                 CRM_STATE_DIR, CRM_DAEMON_USER, pcmk_gid);
 
30
-    }
 
31
+    mcp_chown(CRM_STATE_DIR, pcmk_uid, pcmk_gid);
 
32
 
 
33
     /* Used by stonithd */
 
34
     build_path(HA_STATE_DIR "/heartbeat", 0755);
 
35
+    mcp_chown(HA_STATE_DIR, pcmk_uid, pcmk_gid);
 
36
 
 
37
     /* Used by RAs - Leave owned by root */
 
38
     build_path(CRM_RSCTMP_DIR, 0755);
 
39
 
 
40
     /* Used to store core files in */
 
41
     build_path(CRM_CORE_DIR, 0755);
 
42
+    mcp_chown(CRM_CORE_DIR, pcmk_uid, pcmk_gid);
 
43
+
 
44
+    /* Used to store blackbox dumps in */
 
45
+    build_path(CRM_BLACKBOX_DIR, 0755);
 
46
+    mcp_chown(CRM_BLACKBOX_DIR, pcmk_uid, pcmk_gid);
 
47
+
 
48
+    /* Used to store policy engine inputs in */
 
49
+    build_path(PE_STATE_DIR, 0755);
 
50
+    mcp_chown(PE_STATE_DIR, pcmk_uid, pcmk_gid);
 
51
+
 
52
+    /* Used to store the cluster configuration */
 
53
+    build_path(CRM_CONFIG_DIR, 0755);
 
54
+    mcp_chown(CRM_CONFIG_DIR, pcmk_uid, pcmk_gid);
 
55
 
 
56
     /* Per-user core directories */
 
57
     if (mkdir(CRM_CORE_DIR"/root", 0700) < 0 && errno != EEXIST) {
 
58
@@ -798,9 +818,7 @@ struct qb_ipcs_service_handlers ipc_callbacks =
 
59
     if (mkdir(CRM_CORE_DIR"/"CRM_DAEMON_USER, 0700) < 0 && errno != EEXIST) {
 
60
         crm_perror(LOG_INFO, "Could not create %s", CRM_CORE_DIR"/"CRM_DAEMON_USER);
 
61
     } else {
 
62
-        if(chown(CRM_CORE_DIR"/"CRM_DAEMON_USER, pcmk_uid, pcmk_gid) < 0) {
 
63
-            crm_perror(LOG_ERR, "Could not change the ownership of %s to %s", CRM_CORE_DIR"/"CRM_DAEMON_USER, CRM_DAEMON_USER);
 
64
-        }
 
65
+        mcp_chown(CRM_CORE_DIR, pcmk_uid, pcmk_gid);
 
66
     }
 
67
 
 
68
     client_list = g_hash_table_new(g_direct_hash, g_direct_equal);