about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/skaembutils/s6-ln.c4
-rw-r--r--src/skaembutils/s6-uniquename.c4
-rw-r--r--src/skaembutils/s6-update-symlinks.c4
3 files changed, 9 insertions, 3 deletions
diff --git a/src/skaembutils/s6-ln.c b/src/skaembutils/s6-ln.c
index 7f6f7b6..d8d95c8 100644
--- a/src/skaembutils/s6-ln.c
+++ b/src/skaembutils/s6-ln.c
@@ -55,7 +55,7 @@ static void force (char const *old, char const *new, linkfunc_t_ref doit)
     if (errno != EEXIST)
       strerr_diefu5sys(111, "make a link", " from ", new, " to ", old) ;
     if (!stralloc_catb(&satmp, new, str_len(new))
-     || (random_sauniquename(&satmp, 8) == -1)
+     || !random_sauniquename(&satmp, 8)
      || !stralloc_0(&satmp))
       strerr_diefu2sys(111, "make a unique name for ", old) ;
     if ((*doit)(old, satmp.s + base) == -1)
@@ -98,6 +98,8 @@ int main (int argc, char const *const *argv)
     argc -= l.ind ; argv += l.ind ;
   }
   if (argc < 2) strerr_dieusage(100, USAGE) ;
+  if (!random_init())
+    strerr_diefu1sys(111, "init random generator") ;
   if (argc > 2)
   {
     stralloc sa = STRALLOC_ZERO ;
diff --git a/src/skaembutils/s6-uniquename.c b/src/skaembutils/s6-uniquename.c
index 06418e5..2ac3adb 100644
--- a/src/skaembutils/s6-uniquename.c
+++ b/src/skaembutils/s6-uniquename.c
@@ -31,8 +31,10 @@ int main (int argc, char const *const *argv)
     argc -= l.ind ; argv += l.ind ;
   }
   if (argc < 1) usage() ;
+  if (!random_init())
+    strerr_diefu1sys(111, "init random generator") ;
   if (!stralloc_cats(&sa, argv[0])) strerr_diefu1sys(111, "stralloc_cats") ;
-  if ((n ? random_sauniquename(&sa, n) : sauniquename(&sa)) < 0)
+  if (!(n ? random_sauniquename(&sa, n) : sauniquename(&sa)))
     strerr_diefu1sys(111, "make unique name") ;
   if (!stralloc_catb(&sa, "\n", 1)) strerr_diefu1sys(111, "stralloc_cats") ;
   if (allwrite(1, sa.s, sa.len) < sa.len) strerr_diefu1sys(111, "write to stdout") ;
diff --git a/src/skaembutils/s6-update-symlinks.c b/src/skaembutils/s6-update-symlinks.c
index ba89b06..91d76fa 100644
--- a/src/skaembutils/s6-update-symlinks.c
+++ b/src/skaembutils/s6-update-symlinks.c
@@ -51,7 +51,7 @@ static int makeuniquename (stralloc *sa, char const *path, char const *magic)
   int wasnull = !sa->s ;
   if (!stralloc_cats(sa, path)) return 0 ;
   if (!stralloc_cats(sa, magic)) goto err ;
-  if (random_sauniquename(sa, 8) == -1) goto err ;
+  if (!random_sauniquename(sa, 8)) goto err ;
   if (!stralloc_0(sa)) goto err ;
   return 1 ;
 
@@ -307,6 +307,8 @@ int main (int argc, char *const *argv)
     while (i && (argv[1][i-1] == '/')) argv[1][--i] = 0 ;
     if (!i) strerr_diefu1x(100, "replace root directory") ;
   }
+  if (!random_init())
+    strerr_diefu1sys(111, "init random generator") ;
   if (!makeuniquename(&blah.dst, argv[1], MAGICNEW))
     strerr_diefu2sys(111, "make random unique name based on ", argv[1]) ;
   if ((unlink(blah.dst.s) == -1) && (errno != ENOENT))