summaryrefslogtreecommitdiffstats
path: root/src/phrecn.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-07-09 08:36:46 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-07-09 08:36:46 +0200
commit32d4804ebde324f94212115f684c700d1fe6accf (patch)
tree9ddbbc8fc962f603c8ce441bc9af19427b97da46 /src/phrecn.c
parent8c965e479160677842331d2aba7a82d51055e539 (diff)
PhotoRec: avoid the extra slash in //recup_dir.1 directory name
Diffstat (limited to 'src/phrecn.c')
-rw-r--r--src/phrecn.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/phrecn.c b/src/phrecn.c
index 68602d7..a77beb3 100644
--- a/src/phrecn.c
+++ b/src/phrecn.c
@@ -380,7 +380,8 @@ int photorec(struct ph_param *params, const struct ph_options *options, alloc_da
free(params->recup_dir);
params->recup_dir=(char *)MALLOC(strlen(res)+1+strlen(DEFAULT_RECUP_DIR)+1);
strcpy(params->recup_dir,res);
- strcat(params->recup_dir,"/");
+ if(strcmp(params->recup_dir,"/")!=0)
+ strcat(params->recup_dir,"/");
strcat(params->recup_dir,DEFAULT_RECUP_DIR);
free(res);
/* Create the directory */
@@ -463,7 +464,8 @@ int photorec(struct ph_param *params, const struct ph_options *options, alloc_da
}
filename=(char *)MALLOC(strlen(dst_path) + 1 + strlen(DEFAULT_IMAGE_NAME) + 1);
strcpy(filename, dst_path);
- strcat(filename, "/");
+ if(strcmp(params->recup_dir,"/")!=0)
+ strcat(filename, "/");
strcat(filename, DEFAULT_IMAGE_NAME);
gen_image(filename, params->disk, list_search_space);
free(filename);