- more systemd journal fixes - nfs module fix - install also /lib/modprobe.d/* - fixed dracut-shutdown service - safeguards for dracut-install - for --include also copy symlinks
66 lines
2.4 KiB
Diff
66 lines
2.4 KiB
Diff
From f6c2faebfafb95ae7ce14fe678582077af20c3c0 Mon Sep 17 00:00:00 2001
|
|
From: Harald Hoyer <harald@redhat.com>
|
|
Date: Wed, 11 Jul 2012 15:47:10 +0200
|
|
Subject: [PATCH] install/dracut-install.c: check for empty or "/" destdir
|
|
|
|
---
|
|
install/dracut-install.c | 17 +++++++++++------
|
|
1 file changed, 11 insertions(+), 6 deletions(-)
|
|
|
|
diff --git a/install/dracut-install.c b/install/dracut-install.c
|
|
index ee6950a..9351472 100644
|
|
--- a/install/dracut-install.c
|
|
+++ b/install/dracut-install.c
|
|
@@ -182,7 +182,7 @@ static int cp(const char *src, const char *dst)
|
|
int pid;
|
|
int ret;
|
|
|
|
- if(use_clone) {
|
|
+ if (use_clone) {
|
|
struct stat sb;
|
|
int dest_desc, source_desc;
|
|
|
|
@@ -197,8 +197,8 @@ static int cp(const char *src, const char *dst)
|
|
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);
|
|
@@ -379,7 +379,6 @@ static int dracut_install(const char *src, const char *dst, bool isdir, bool res
|
|
}
|
|
}
|
|
|
|
-
|
|
i = strdup(dst);
|
|
hashmap_put(items, i, i);
|
|
|
|
@@ -731,15 +730,21 @@ int main(int argc, char **argv)
|
|
|
|
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);
|
|
|