From 804dabc5b64a0b5ec03bc0df8e943944afb022a7 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 14 Dec 2013 18:54:56 +0000
Subject: [PATCH] builder: Refuse to write to a char device or /dev/null.
virt-builder --output /dev/null is tempting, but not possible, and
might result in /dev/null being deleted(!) Check for this case and
prevent it happening.
(cherry picked from commit 3cf5a25e3f63ea6832b96468a94cdb13dbd26e92)
---
builder/builder.ml | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/builder/builder.ml b/builder/builder.ml
index 975284d..019fd23 100644
--- a/builder/builder.ml
+++ b/builder/builder.ml
@@ -279,6 +279,11 @@ let main () =
exit 1
);
+ if is_char_device output_filename then (
+ eprintf (f_"%s: cannot output to a character device or /dev/null\n") prog;
+ exit 1
+ );
+
let goal =
(* MUST *)
let goal_must = [
--
1.8.3.1