Based on bde29068aa3815c88190a91e9867605a0aeaf9c4 Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 23 Jun 2014 19:18:44 +0200
Subject: [PATCH] cryptsetup: don't add unit dependency on /dev/null devices
 when it is listed as password file

As special magic, don't create device dependencies for /dev/null. Of
course, there might be similar devices we might want to include, but
given that none of them really make sense to specify as password source
there's really no point in checking for anything else here.

https://bugs.freedesktop.org/show_bug.cgi?id=75816
---
 src/cryptsetup/cryptsetup-generator.c |   21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

--- src/cryptsetup/cryptsetup-generator.c
+++ src/cryptsetup/cryptsetup-generator.c	2014-06-25 17:24:14.338237375 +0000
@@ -29,6 +29,7 @@
 #include "mkdir.h"
 #include "strv.h"
 #include "fileio.h"
+#include "path-util.h"
 
 static const char *arg_dest = "/tmp";
 static bool arg_enabled = true;
@@ -141,14 +142,18 @@ static int create_disk(
                         if (uu == NULL)
                                 return log_oom();
 
-                        if (is_device_path(uu)) {
-                                _cleanup_free_ char *dd = unit_name_from_path(uu, ".device");
-                                if (dd == NULL)
-                                        return log_oom();
-
-                                fprintf(f, "After=%1$s\nRequires=%1$s\n", dd);
-                        } else
-                                fprintf(f, "RequiresMountsFor=%s\n", password);
+                        if (!path_equal(uu, "/dev/null")) {
+                                if (is_device_path(uu)) {
+                                        _cleanup_free_ char *dd;
+
+                                        dd = unit_name_from_path(uu, ".device");
+                                        if (!dd)
+                                                return log_oom();
+
+                                        fprintf(f, "After=%1$s\nRequires=%1$s\n", dd);
+                                } else
+                                        fprintf(f, "RequiresMountsFor=%s\n", password);
+                        }
                 }
         }
 
