]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
There is a situation when moving a task from child cgroup
authorWeng Meiling <wengmeiling.weng@huawei.com>
Fri, 4 Apr 2014 07:58:20 +0000 (09:58 +0200)
committerWeng Meiling <wengmeiling.weng@huawei.com>
Fri, 4 Apr 2014 07:58:20 +0000 (09:58 +0200)
to parent cgroup, the task exited. This will lead to service
cgconfig start failed. So ignore the error ESRCH.

Signed-off-by: Weng Meiling <wengmeiling.weng@huawei.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
src/api.c

index bfd0177b987c6fdc6aca42238eb1806e77367f63..0b3d8a07ab3cd85ed543704f2e7cc3cb685f84b4 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -1897,15 +1897,23 @@ static int cg_move_task_files(FILE *input_tasks, FILE *output_tasks)
                        break;
 
                ret = fprintf(output_tasks, "%d", tids);
-               if (ret < 0)
-                       break;
+               if (ret < 0) {
+                       if (errno == ESRCH)
+                               ret = 0;
+                       else
+                               break;
+               }
 
                /*
                 * Flush the file, we need only one process per write() call.
                 */
                ret = fflush(output_tasks);
-               if (ret < 0)
-                       break;
+               if (ret < 0) {
+                       if (errno == ESRCH)
+                               ret = 0;
+                       else
+                               break;
+               }
        }
 
        if (ret < 0) {