From dedcfa480ee21b9bb87964eb1e2665fe6a200b4c Mon Sep 17 00:00:00 2001 From: Balbir Singh Date: Mon, 16 Feb 2009 13:34:12 +0000 Subject: 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 Signed-off-by: Balbir Singh git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@329 4f4bb910-9a46-0410-90c8-c897d4f1cd53 --- config.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'config.c') diff --git a/config.c b/config.c index 154ebad..95782f6 100644 --- a/config.c +++ b/config.c @@ -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; } -- cgit