[yocto] [psplash][PATCH 2/3] use /run for communication FIFO

Stefan Agner stefan at agner.ch
Mon Feb 25 07:16:18 PST 2019


From: Stefan Agner <stefan.agner at toradex.com>

Use /run for communication FIFO which is typically preserved
between initramfs and regular root file system. Introduce a
new environment variable PSPLASH_FIFO_DIR which allows to
pass /tmp for the old behavior or another directory.

Signed-off-by: Stefan Agner <stefan.agner at toradex.com>
---
 psplash-write.c | 10 +++++-----
 psplash.c       | 10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/psplash-write.c b/psplash-write.c
index 3fdba95..f0aeda1 100644
--- a/psplash-write.c
+++ b/psplash-write.c
@@ -29,13 +29,13 @@
 
 int main(int argc, char **argv) 
 {
-  char *tmpdir;
+  char *rundir;
   int   pipe_fd;
 
-  tmpdir = getenv("TMPDIR");
+  rundir = getenv("PSPLASH_FIFO_DIR");
 
-  if (!tmpdir)
-    tmpdir = "/tmp";
+  if (!rundir)
+    rundir = "/run";
 
   if (argc!=2) 
     {
@@ -43,7 +43,7 @@ int main(int argc, char **argv)
       exit(-1);
     }
   
-  chdir(tmpdir);
+  chdir(rundir);
   
   if ((pipe_fd = open (PSPLASH_FIFO,O_WRONLY|O_NONBLOCK)) == -1)
     {
diff --git a/psplash.c b/psplash.c
index 992e199..169f9c1 100644
--- a/psplash.c
+++ b/psplash.c
@@ -204,7 +204,7 @@ psplash_main (PSplashFB *fb, int pipe_fd, int timeout)
 int 
 main (int argc, char** argv) 
 {
-  char      *tmpdir;
+  char      *rundir;
   int        pipe_fd, i = 0, angle = 0, fbdev_id = 0, ret = 0;
   PSplashFB *fb;
   bool       disable_console_switch = FALSE;
@@ -241,12 +241,12 @@ main (int argc, char** argv)
       exit(-1);
   }
 
-  tmpdir = getenv("TMPDIR");
+  rundir = getenv("PSPLASH_FIFO_DIR");
 
-  if (!tmpdir)
-    tmpdir = "/tmp";
+  if (!rundir)
+    rundir = "/run";
 
-  chdir(tmpdir);
+  chdir(rundir);
 
   if (mkfifo(PSPLASH_FIFO, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP))
     {
-- 
2.20.1



More information about the yocto mailing list