int pid;
int ret;
- if(use_clone) {
+ if (use_clone) {
struct stat sb;
int dest_desc, source_desc;
goto normal_copy;
dest_desc =
- open(dst, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC,
- (sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
+ open(dst, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC,
+ (sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
if (dest_desc < 0) {
close(source_desc);
}
}
-
i = strdup(dst);
hashmap_put(items, i, i);
umask(0022);
- if (destrootdir == NULL) {
+ if (destrootdir == NULL || strlen(destrootdir) == 0) {
destrootdir = getenv("DESTROOTDIR");
- if (destrootdir == NULL) {
+ if (destrootdir == NULL || strlen(destrootdir) == 0) {
log_error("Environment DESTROOTDIR or argument -D is not set!");
usage(EXIT_FAILURE);
}
destrootdir = strdup(destrootdir);
}
+ if (strcmp(destrootdir, "/") == 0) {
+ log_error("Environment DESTROOTDIR or argument -D is set to '/'!");
+ usage(EXIT_FAILURE);
+
+ }
+
items = hashmap_new(string_hash_func, string_compare_func);
items_failed = hashmap_new(string_hash_func, string_compare_func);