| 1052 | } |
| 1053 | |
| 1054 | static void |
| 1055 | init(void) |
| 1056 | { |
| 1057 | if (cf_restricted_init && !invoked_by_root) |
| 1058 | die("New sandboxes can be created only by root"); |
| 1059 | |
| 1060 | lock_box(true, false); |
| 1061 | |
| 1062 | do_cleanup(); |
| 1063 | |
| 1064 | msg("Preparing sandbox\n"); |
| 1065 | make_dir(box_dir); |
| 1066 | if (chdir(box_dir) < 0) |
| 1067 | die("chdir(%s): %m", box_dir); |
| 1068 | if (mkdir("box", 0700) < 0) |
| 1069 | die("Cannot create box: %m"); |
| 1070 | if (chown("box", orig_uid, orig_gid) < 0) |
| 1071 | die("Cannot chown box: %m"); |
| 1072 | |
| 1073 | cg_create(); |
| 1074 | set_quota(); |
| 1075 | |
| 1076 | lock.is_initialized = 1; |
| 1077 | lock_write(); |
| 1078 | |
| 1079 | puts(box_dir); |
| 1080 | } |
| 1081 | |
| 1082 | static void |
| 1083 | cleanup(void) |
no test coverage detected
searching dependent graphs…