Skip to content

Commit

Permalink
Create a tmp dir under each package if it does not exist
Browse files Browse the repository at this point in the history
	Directly mounting the /tmp dir of the host machine to each package
	results in all packages share the same /tmp dir.
  • Loading branch information
haiyanmeng committed Jan 22, 2015
1 parent fdf17f1 commit fa3997b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion parrot/src/parrot_package_create.c
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,16 @@ int post_process( ) {
char new_envlist[PATH_MAX], common_mountlist[PATH_MAX], size_cmd[PATH_MAX], cmd_rv[100];
FILE *file, *cmd_fp;

//create a tmp dir under the package if it does not exist
char tmp_path[PATH_MAX];
snprintf(tmp_path, PATH_MAX, "%s/tmp", packagepath);
if(access(tmp_path, F_OK) == -1) {
if(mkdir(tmp_path, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) == -1) {
debug(D_DEBUG, "Create tmp dir under the package (%s) fails: %s\n", tmp_path, strerror(errno));
return -1;
}
}

snprintf(new_envlist, PATH_MAX, "%s/%s", packagepath, "env_list");
if(copy_file_to_file(envlist, new_envlist) == -1) {
debug(D_DEBUG, "copy_file_to_file(`%s`) fails.\n", envlist);
Expand All @@ -534,7 +544,6 @@ int post_process( ) {
(fputs("/proc /proc\n", file) == EOF) ||
(fputs("/sys /sys\n", file) == EOF) ||
(fputs("/var /var\n", file) == EOF) ||
(fputs("/tmp /tmp\n", file) == EOF) ||
(fputs("/selinux /selinux\n", file) == EOF)) {
debug(D_DEBUG, "fputs fails: %s\n", strerror(errno));
exit(EXIT_FAILURE);
Expand Down

0 comments on commit fa3997b

Please sign in to comment.