Signed-off-by: Serge Hallyn <serge.hal...@ubuntu.com>
---
 src/lxc/cgroup.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/lxc/cgroup.c b/src/lxc/cgroup.c
index c707519..a61d210 100644
--- a/src/lxc/cgroup.c
+++ b/src/lxc/cgroup.c
@@ -769,16 +769,23 @@ int lxc_cgroup_enter(const char *cgpath, pid_t pid)
                ret = snprintf(path, MAXPATHLEN, "%s/%s/tasks",
                               mntent_r.mnt_dir, cgpath);
                if (ret < 0 || ret >= MAXPATHLEN) {
-                       ERROR("entering cgroup");
+                       ERROR("Error entering cgroup");
                        goto out;
                }
                fout = fopen(path, "w");
                if (!fout) {
-                       ERROR("entering cgroup");
+                       SYSERROR("Error entering cgroup");
+                       goto out;
+               }
+               if (fprintf(fout, "%d\n", (int)pid) < 0) {
+                       ERROR("Error writing pid to %s", path);
+                       fclose(fout);
+                       goto out;
+               }
+               if (fclose(fout) < 0) {
+                       SYSERROR("Error writing pid to %s", path);
                        goto out;
                }
-               fprintf(fout, "%d\n", (int)pid);
-               fclose(fout);
        }
        retv = 0;
 
-- 
1.8.1.2


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Lxc-devel mailing list
Lxc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/lxc-devel

Reply via email to