diff options
author | Balbir Singh <balbir@linux.vnet.ibm.com> | 2009-02-16 13:34:12 +0000 |
---|---|---|
committer | Balbir Singh <balbir@linux.vnet.ibm.com> | 2009-02-16 13:34:12 +0000 |
commit | dedcfa480ee21b9bb87964eb1e2665fe6a200b4c (patch) | |
tree | 61e4516a1f28071d8cb6604f8adb330eb598d3a0 /config.c | |
parent | b4ca5d9b4a38994aa71fbdb14fd5d65c81bf5216 (diff) | |
download | libcg-dedcfa480ee21b9bb87964eb1e2665fe6a200b4c.tar.gz libcg-dedcfa480ee21b9bb87964eb1e2665fe6a200b4c.tar.xz libcg-dedcfa480ee21b9bb87964eb1e2665fe6a200b4c.zip |
This patch store the last errno value to last_errno value and add
cgroup_add_last_errno procedure to show this number.
Use this procedure to show the cause of the error when ECGOTHER is returned.
[balbir@linux.vnet.ibm.com: fix last_errno in config.c]
Signed-off-by: Ivana Varekova <varekova@redhat.com>
Signed-off-by: Balbir Singh <balbir@linux.vnet.ibm.com>
git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@329 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -339,17 +339,22 @@ int cgroup_config_mount_fs() struct cg_mount_table_s *curr = &(config_mount_table[i]); ret = stat(curr->path, &buff); - - if (ret < 0 && errno != ENOENT) + + if (ret < 0 && errno != ENOENT) { + last_errno = errno; return ECGOTHER; + } if (errno == ENOENT) { ret = mkdir(curr->path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); - if (ret < 0) + if (ret < 0) { + last_errno = errno; return ECGOTHER; + } } else if (!S_ISDIR(buff.st_mode)) { errno = ENOTDIR; + last_errno = errno; return ECGOTHER; } @@ -432,6 +437,7 @@ int cgroup_config_load_config(const char *pathname) if (!yyin) { dbg("Failed to open file %s\n", pathname); + last_errno = errno; return ECGOTHER; } |