~ubuntu-branches/ubuntu/oneiric/lxc/oneiric-201108112013

« back to all changes in this revision

Viewing changes to src/lxc/lxc_unshare.c

  • Committer: Stéphane Graber
  • Date: 2011-08-11 18:43:59 UTC
  • mfrom: (1.1.10 upstream)
  • Revision ID: stgraber@ubuntu.com-20110811184359-lkqgeuimw8n5efzj
Merge 0.7.5

Show diffs side-by-side

added added

removed removed

Lines of Context:
46
46
{
47
47
        fprintf(stderr, "%s <options> [command]\n", basename(cmd));
48
48
        fprintf(stderr, "Options are:\n");
49
 
        fprintf(stderr, "\t -s flags: Ored list of flags to unshare:\n" \
 
49
        fprintf(stderr, "\t -s flags: ORed list of flags to unshare:\n" \
50
50
                        "\t           MOUNT, PID, UTSNAME, IPC, USER, NETWORK\n");
51
51
        fprintf(stderr, "\t -u <id> : new id to be set if -s USER is specified\n");
52
 
        fprintf(stderr, "\t if -f or -s PID is specified, <command> is mandatory)\n");
 
52
        fprintf(stderr, "\t if -s PID is specified, <command> is mandatory)\n");
53
53
        _exit(1);
54
54
}
55
55
 
210
210
                return -1;
211
211
        }
212
212
 
213
 
        if (asprintf(&pid_name, "%d", pid) == -1) {
214
 
                ERROR("pid_name: failed to allocate memory");
215
 
                return -1;
 
213
        if (lxc_ns_is_mounted()) {
 
214
                if (asprintf(&pid_name, "%d", pid) == -1) {
 
215
                        ERROR("pid_name: failed to allocate memory");
 
216
                        return -1;
 
217
                }
 
218
                lxc_cgroup_destroy(pid_name);
 
219
                free(pid_name);
216
220
        }
217
 
        lxc_cgroup_destroy(pid_name);
218
 
        free(pid_name);
219
221
 
220
222
        return  lxc_error_set_and_log(pid, status);
221
223
}