summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--INSTALL4
-rw-r--r--NEWS6
-rw-r--r--doc/index.html6
-rw-r--r--doc/upgrade.html10
-rw-r--r--package/info2
-rw-r--r--src/libs6/s6_supervise_lock_mode.c44
-rw-r--r--src/libs6/s6_svc_lock_take.c6
7 files changed, 62 insertions, 16 deletions
diff --git a/INSTALL b/INSTALL
index 89716ea..1fac26d 100644
--- a/INSTALL
+++ b/INSTALL
@@ -6,8 +6,8 @@ Build Instructions
- A POSIX-compliant C development environment
- GNU make version 3.81 or later
- - skalibs version 2.9.2.1 or later: http://skarnet.org/software/skalibs/
- - Optional: execline version 2.6.0.1 or later: http://skarnet.org/software/execline/
+ - skalibs version 2.9.4.0 or later: http://skarnet.org/software/skalibs/
+ - Optional: execline version 2.6.1.1 or later: http://skarnet.org/software/execline/
This software will run on any operating system that implements
POSIX.1-2008, available at:
diff --git a/NEWS b/NEWS
index b35f150..2ec3b85 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,11 @@
Changelog for s6.
+In 2.9.2.1
+----------
+
+ - Bugfixes.
+
+
In 2.9.2.0
----------
diff --git a/doc/index.html b/doc/index.html
index 7f55ca9..37fd21f 100644
--- a/doc/index.html
+++ b/doc/index.html
@@ -83,11 +83,11 @@ with s6</a> </li>
<li> A POSIX-compliant system with a standard C development environment </li>
<li> GNU make, version 3.81 or later </li>
<li> <a href="//skarnet.org/software/skalibs/">skalibs</a> version
-2.9.2.1 or later. It's a build-time requirement. It's also a run-time
+2.9.4.0 or later. It's a build-time requirement. It's also a run-time
requirement if you link against the shared version of the skalibs
library. </li>
<li> Optional: <a href="//skarnet.org/software/execline/">execline</a> version
-2.6.0.1 or later. When s6 is built with execline support (which is the default),
+2.6.1.1 or later. When s6 is built with execline support (which is the default),
execline is a build-time requirement, and also a run-time requirement for
certain binaries that spawn scripts interpreted with
<a href="//skarnet.org/software/execline/execlineb.html">execlineb</a>. </li>
@@ -103,7 +103,7 @@ certain binaries that spawn scripts interpreted with
<h3> Download </h3>
<ul>
- <li> The current released version of s6 is <a href="s6-2.9.2.0.tar.gz">2.9.2.0</a>. </li>
+ <li> The current released version of s6 is <a href="s6-2.9.2.1.tar.gz">2.9.2.1</a>. </li>
<li> Alternatively, you can checkout a copy of the
<a href="//git.skarnet.org/cgi-bin/cgit.cgi/s6/">s6
git repository</a>:
diff --git a/doc/upgrade.html b/doc/upgrade.html
index bae3dd7..7408d83 100644
--- a/doc/upgrade.html
+++ b/doc/upgrade.html
@@ -18,6 +18,16 @@
<h1> What has changed in s6 </h1>
+<h2> in 2.9.2.1 </h2>
+
+<ul>
+ <li> <a href="//skarnet.org/software/skalibs/">skalibs</a>
+dependency bumped to 2.9.4.0. </li>
+ <li> <a href="//skarnet.org/software/execline/">execline</a>
+dependency bumped to 2.6.1.1. </li>
+ <li> New <tt>-d</tt> option to <a href="s6-sudod.html">s6-sudod</a>. </li>
+</ul>
+
<h2> in 2.9.2.0 </h2>
<ul>
diff --git a/package/info b/package/info
index d9fd33f..0ba3d91 100644
--- a/package/info
+++ b/package/info
@@ -1,4 +1,4 @@
package=s6
-version=2.9.2.0
+version=2.9.2.1
category=admin
package_macro_name=S6
diff --git a/src/libs6/s6_supervise_lock_mode.c b/src/libs6/s6_supervise_lock_mode.c
index 039760c..710e3ba 100644
--- a/src/libs6/s6_supervise_lock_mode.c
+++ b/src/libs6/s6_supervise_lock_mode.c
@@ -1,12 +1,22 @@
/* ISC license. */
+#include <limits.h>
+#include <unistd.h>
#include <sys/stat.h>
#include <string.h>
#include <errno.h>
+
#include <skalibs/strerr2.h>
#include <skalibs/djbunix.h>
+
#include <s6/s6-supervise.h>
+#ifdef PATH_MAX
+# define S6_PATH_MAX PATH_MAX
+#else
+# define S6_PATH_MAX 4096
+#endif
+
int s6_supervise_lock_mode (char const *subdir, unsigned int subdirmode, unsigned int controlmode)
{
size_t subdirlen = strlen(subdir) ;
@@ -17,8 +27,28 @@ int s6_supervise_lock_mode (char const *subdir, unsigned int subdirmode, unsigne
memcpy(control + subdirlen, "/control", 9) ;
memcpy(lock, subdir, subdirlen) ;
memcpy(lock + subdirlen, "/lock", 6) ;
- if ((mkdir(subdir, (mode_t)subdirmode) == -1) && (errno != EEXIST))
- strerr_diefu2sys(111, "mkdir ", subdir) ;
+ if (mkdir(subdir, (mode_t)subdirmode) == -1)
+ {
+ if (errno != EEXIST) strerr_diefu2sys(111, "mkdir ", subdir) ;
+ else
+ {
+ char buf[S6_PATH_MAX] ;
+ ssize_t r = readlink(subdir, buf, S6_PATH_MAX) ;
+ if (r < 0)
+ {
+ errno = EEXIST ;
+ strerr_diefu2sys(111, "mkdir ", subdir) ;
+ }
+ if (r == S6_PATH_MAX)
+ {
+ errno = ENAMETOOLONG ;
+ strerr_diefu2sys(111, "readlink ", subdir) ;
+ }
+ buf[r] = 0 ;
+ if (mkdir(buf, (mode_t)subdirmode) == -1)
+ strerr_diefu2sys(111, "mkdir ", buf) ;
+ }
+ }
if (mkfifo(control, controlmode) < 0)
{
struct stat st ;
@@ -29,24 +59,22 @@ int s6_supervise_lock_mode (char const *subdir, unsigned int subdirmode, unsigne
if (!S_ISFIFO(st.st_mode))
strerr_diefu2x(100, control, " is not a FIFO") ;
}
- fdlock = open_create(lock) ;
+ fdlock = open_createcoe(lock) ;
if (fdlock < 0)
strerr_diefu2sys(111, "open_create ", lock) ;
if (lock_ex(fdlock) < 0)
strerr_diefu2sys(111, "lock ", lock) ;
- fdctlw = open_write(control) ;
+ fdctlw = open_writecoe(control) ;
if (fdctlw >= 0) strerr_dief1x(100, "directory already locked") ;
if (errno != ENXIO)
strerr_diefu2sys(111, "open_write ", control) ;
- fdctl = open_read(control) ;
+ fdctl = open_readcoe(control) ;
if (fdctl < 0)
strerr_diefu2sys(111, "open_read ", control) ;
- fdctlw = open_write(control) ;
+ fdctlw = open_writecoe(control) ;
if (fdctlw < 0)
strerr_diefu2sys(111, "open_write ", control) ;
fd_close(fdlock) ;
- if ((coe(fdctlw) < 0) || (coe(fdctl) < 0))
- strerr_diefu2sys(111, "coe ", control) ;
return fdctl ;
/* fdctlw is leaking. That's okay, it's coe. */
diff --git a/src/libs6/s6_svc_lock_take.c b/src/libs6/s6_svc_lock_take.c
index 3dec282..a98aeab 100644
--- a/src/libs6/s6_svc_lock_take.c
+++ b/src/libs6/s6_svc_lock_take.c
@@ -6,6 +6,8 @@
#include <skalibs/djbunix.h>
#include <s6/s6-supervise.h>
+ /* XXX: does not work with dangling S6_SUPERVISE_CTLDIR symlinks */
+
int s6_svc_lock_take (char const *dir)
{
size_t dirlen = strlen(dir) ;
@@ -15,9 +17,9 @@ int s6_svc_lock_take (char const *dir)
memcpy(lock + dirlen, "/" S6_SUPERVISE_CTLDIR, sizeof(S6_SUPERVISE_CTLDIR) + 1) ;
if ((mkdir(lock, S_IRWXU) < 0) && (errno != EEXIST)) return -1 ;
memcpy(lock + dirlen + sizeof(S6_SUPERVISE_CTLDIR), "/lock", 6) ;
- fdlock = open_create(lock) ;
+ fdlock = open_createcoe(lock) ;
if (fdlock < 0) return -1 ;
- if (coe(fdlock) < 0 || lock_ex(fdlock) < 0)
+ if (lock_ex(fdlock) < 0)
{
fd_close(fdlock) ;
return -1 ;