diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2019-01-09 12:47:51 +0000 |
---|---|---|
committer | Laurent Bercot <ska-skaware@skarnet.org> | 2019-01-09 12:47:51 +0000 |
commit | 214fcdea64c0a1b64cd7497652340a64460e2ab7 (patch) | |
tree | 3b4dbcd4bcc1aa68dc60e3069083ccea6aaecf13 | |
parent | 82c6c7780b3b573c45b0013d8955d928236f1fe9 (diff) | |
download | s6-214fcdea64c0a1b64cd7497652340a64460e2ab7.tar.xz |
Use mkptemp() in s6-ftrigrd. Prepare for 2.7.2.3.
-rw-r--r-- | COPYING | 2 | ||||
-rw-r--r-- | INSTALL | 4 | ||||
-rw-r--r-- | NEWS | 7 | ||||
-rw-r--r-- | doc/index.html | 6 | ||||
-rw-r--r-- | doc/upgrade.html | 7 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/libs6/ftrig1.h | 3 | ||||
-rw-r--r-- | src/libs6/ftrig1_make.c | 54 | ||||
-rw-r--r-- | src/libs6/ftrigw_notifyb_nosig.c | 15 | ||||
-rw-r--r-- | src/libs6/s6-ftrigrd.c | 1 |
10 files changed, 46 insertions, 55 deletions
@@ -1,4 +1,4 @@ -Copyright (c) 2011-2018 Laurent Bercot <ska-skaware@skarnet.org> +Copyright (c) 2011-2019 Laurent Bercot <ska-skaware@skarnet.org> Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -6,8 +6,8 @@ Build Instructions - A POSIX-compliant C development environment - GNU make version 3.81 or later - - skalibs version 2.7.0.0 or later: http://skarnet.org/software/skalibs/ - - execline version 2.5.0.1 or later: http://skarnet.org/software/execline/ + - skalibs version 2.8.0.0 or later: http://skarnet.org/software/skalibs/ + - execline version 2.5.0.2 or later: http://skarnet.org/software/execline/ This software will run on any operating system that implements POSIX.1-2008, available at: @@ -1,5 +1,12 @@ Changelog for s6. +In 2.7.2.3 +---------- + + - Bugfixes. + - Adaptation to skalibs-2.8.0.0. + + In 2.7.2.2 ---------- diff --git a/doc/index.html b/doc/index.html index 5a54c2f..40b9b33 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.7.0.0 or later. It's a build-time requirement. It's also a run-time +2.8.0.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> <a href="//skarnet.org/software/execline/">execline</a> version -2.5.0.1 or later. It's a build-time and run-time requirement. </li> +2.5.0.2 or later. It's a build-time and run-time requirement. </li> </ul> <h3> Licensing </h3> @@ -100,7 +100,7 @@ library. </li> <h3> Download </h3> <ul> - <li> The current released version of s6 is <a href="s6-2.7.2.2.tar.gz">2.7.2.2</a>. </li> + <li> The current released version of s6 is <a href="s6-2.7.2.3.tar.gz">2.7.2.3</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 b74a335..57f5dcd 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,13 @@ <h1> What has changed in s6 </h1> +<h2> in 2.7.2.3 </h2> + +<ul> + <li> skalibs dependency bumped to 2.8.0.0. </li> + <li> execline dependency bumped to 2.5.0.2. </li> +</ul> + <h2> in 2.7.2.2 </h2> <ul> <li> No functional changes. </li> diff --git a/package/info b/package/info index 4dd2166..fdfa567 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6 -version=2.7.2.2 +version=2.7.2.3 category=admin package_macro_name=S6 diff --git a/src/libs6/ftrig1.h b/src/libs6/ftrig1.h index aa06b57..89f11ba 100644 --- a/src/libs6/ftrig1.h +++ b/src/libs6/ftrig1.h @@ -3,6 +3,7 @@ #ifndef FTRIG1_H #define FTRIG1_H +#include <skalibs/gccattributes.h> #include <skalibs/stralloc.h> #define FTRIG1_PREFIX "ftrig1" @@ -17,7 +18,7 @@ struct ftrig1_s } ; #define FTRIG1_ZERO { .fd = -1, .fdw = -1, .name = STRALLOC_ZERO } -extern void ftrig1_init (void) ; +extern void ftrig1_init (void) gccattr_deprecated ; extern int ftrig1_make (ftrig1_t *, char const *) ; extern void ftrig1_free (ftrig1_t *) ; diff --git a/src/libs6/ftrig1_make.c b/src/libs6/ftrig1_make.c index 8f6d985..2c224e5 100644 --- a/src/libs6/ftrig1_make.c +++ b/src/libs6/ftrig1_make.c @@ -1,75 +1,49 @@ /* ISC license. */ #include <string.h> -#include <sys/stat.h> -#include <unistd.h> #include <stdio.h> + #include <skalibs/posixplz.h> #include <skalibs/tai.h> #include <skalibs/stralloc.h> #include <skalibs/djbunix.h> -#include <skalibs/surf.h> -#include <skalibs/random.h> -#include "ftrig1.h" -static SURFSchedule surf_ctx = SURFSCHEDULE_ZERO ; +#include "ftrig1.h" void ftrig1_init (void) { - char seed[160] ; - random_makeseed(seed) ; - surf_init(&surf_ctx, seed) ; -} - -static inline void surfname (char *s, size_t n) -{ - static char const oklist[64] = "ABCDEFGHIJKLMNOPQRSTUVWXYZghijklmnopqrstuvwxyz-_0123456789abcdef" ; - surf(&surf_ctx, s, n) ; - while (n--) s[n] = oklist[s[n] & 63] ; + /* deprecated */ } int ftrig1_make (ftrig1_t *f, char const *path) { ftrig1_t ff = FTRIG1_ZERO ; size_t pathlen = strlen(path) ; - char tmp[pathlen + 46 + FTRIG1_PREFIXLEN] ; + char tmp[pathlen + FTRIG1_PREFIXLEN + 36] ; memcpy(tmp, path, pathlen) ; tmp[pathlen] = '/' ; tmp[pathlen+1] = '.' ; memcpy(tmp + pathlen + 2, FTRIG1_PREFIX, FTRIG1_PREFIXLEN) ; tmp[pathlen + 2 + FTRIG1_PREFIXLEN] = ':' ; if (!timestamp(tmp + pathlen + 3 + FTRIG1_PREFIXLEN)) return 0 ; - tmp[pathlen + 28 + FTRIG1_PREFIXLEN] = ':' ; - surfname(tmp + pathlen + 29 + FTRIG1_PREFIXLEN, 16) ; - tmp[pathlen + 45 + FTRIG1_PREFIXLEN] = 0 ; - - { - mode_t m = umask(0) ; - if (mkfifo(tmp, S_IRUSR|S_IWUSR|S_IWGRP|S_IWOTH) == -1) - { - umask(m) ; - return 0 ; - } - umask(m) ; - } - - if (!stralloc_catb(&ff.name, tmp, pathlen+1)) goto err0 ; - if (!stralloc_catb(&ff.name, tmp + pathlen + 2, FTRIG1_PREFIXLEN + 44)) goto err1 ; - ff.fd = open_read(tmp) ; - if (ff.fd == -1) goto err1 ; + memcpy(tmp + pathlen + FTRIG1_PREFIXLEN + 28, ":XXXXXX", 8) ; + ff.fd = mkptemp(tmp) ; + if (ff.fd == -1) return 0 ; ff.fdw = open_write(tmp) ; - if (ff.fdw == -1) goto err2 ; + if (ff.fdw == -1) goto err1 ; + if (!stralloc_ready(&ff.name, pathlen + FTRIG1_PREFIXLEN + 36)) goto err2 ; + stralloc_copyb(&ff.name, tmp, pathlen + 1) ; + stralloc_catb(&ff.name, tmp + pathlen + 2, FTRIG1_PREFIXLEN + 34) ; if (rename(tmp, ff.name.s) == -1) goto err3 ; *f = ff ; return 1 ; err3: - fd_close(ff.fdw) ; + stralloc_free(&ff.name) ; err2: - fd_close(ff.fd) ; + fd_close(ff.fdw) ; err1: - stralloc_free(&ff.name) ; - err0: + fd_close(ff.fd) ; unlink_void(tmp) ; return 0 ; } diff --git a/src/libs6/ftrigw_notifyb_nosig.c b/src/libs6/ftrigw_notifyb_nosig.c index 38110f2..6564396 100644 --- a/src/libs6/ftrigw_notifyb_nosig.c +++ b/src/libs6/ftrigw_notifyb_nosig.c @@ -3,12 +3,14 @@ #include <string.h> #include <unistd.h> #include <errno.h> + #include <skalibs/posixplz.h> #include <skalibs/direntry.h> #include <skalibs/allreadwrite.h> #include <skalibs/djbunix.h> -#include "ftrig1.h" + #include <s6/ftrigw.h> +#include "ftrig1.h" int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len) { @@ -17,9 +19,10 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len) if (!dir) return -1 ; { size_t pathlen = strlen(path) ; - char tmp[pathlen + FTRIG1_PREFIXLEN + 45] ; + char tmp[pathlen + FTRIG1_PREFIXLEN + 35] ; memcpy(tmp, path, pathlen) ; - tmp[pathlen] = '/' ; tmp[pathlen + FTRIG1_PREFIXLEN + 44] = 0 ; + tmp[pathlen] = '/' ; + tmp[pathlen + FTRIG1_PREFIXLEN + 34] = 0 ; for (;;) { direntry *d ; @@ -27,9 +30,9 @@ int ftrigw_notifyb_nosig (char const *path, char const *s, size_t len) errno = 0 ; d = readdir(dir) ; if (!d) break ; - if (strncmp(d->d_name, FTRIG1_PREFIX, FTRIG1_PREFIXLEN)) continue ; - if (strlen(d->d_name) != FTRIG1_PREFIXLEN + 43) continue ; - memcpy(tmp + pathlen + 1, d->d_name, FTRIG1_PREFIXLEN + 43) ; + if (strncmp(d->d_name, FTRIG1_PREFIX ":@", FTRIG1_PREFIXLEN + 2)) continue ; + if (strlen(d->d_name) != FTRIG1_PREFIXLEN + 33) continue ; + memcpy(tmp + pathlen + 1, d->d_name, FTRIG1_PREFIXLEN + 33) ; fd = open_write(tmp) ; if (fd == -1) { diff --git a/src/libs6/s6-ftrigrd.c b/src/libs6/s6-ftrigrd.c index dd04548..e9ac252 100644 --- a/src/libs6/s6-ftrigrd.c +++ b/src/libs6/s6-ftrigrd.c @@ -194,7 +194,6 @@ int main (void) if (ndelay_on(0) < 0) strerr_diefu2sys(111, "ndelay_on ", "0") ; if (ndelay_on(1) < 0) strerr_diefu2sys(111, "ndelay_on ", "1") ; if (sig_ignore(SIGPIPE) < 0) strerr_diefu1sys(111, "ignore SIGPIPE") ; - ftrig1_init() ; { tain_t deadline ; |