diff options
-rw-r--r-- | INSTALL | 2 | ||||
-rwxr-xr-x | configure | 1 | ||||
-rw-r--r-- | doc/index.html | 4 | ||||
-rw-r--r-- | doc/upgrade.html | 6 | ||||
-rw-r--r-- | package/info | 2 | ||||
-rw-r--r-- | src/minutils/s6-hiercopy.c | 156 | ||||
-rw-r--r-- | src/minutils/s6ps_otree.c | 2 |
7 files changed, 11 insertions, 162 deletions
@@ -6,7 +6,7 @@ Build Instructions - A Linux-based system with a standard C development environment - GNU make version 4.0 or later - - skalibs version 2.3.6.1 or later: http://skarnet.org/software/skalibs/ + - skalibs version 2.3.7.1 or later: http://skarnet.org/software/skalibs/ This software is Linux-specific. It will run on a Linux kernel, version 2.6.32 or later. @@ -304,7 +304,6 @@ fi if $shared ; then tryldflag LDFLAGS_AUTO -Wl,--hash-style=both - tryldflag LDFLAGS_SHARED -Wl,-Bsymbolic fi LDFLAGS_SHARED="${LDFLAGS_SHARED}${addlibdpath}" diff --git a/doc/index.html b/doc/index.html index 6ed3234..f02fe69 100644 --- a/doc/index.html +++ b/doc/index.html @@ -33,7 +33,7 @@ <li> A Linux-based system with a standard C development environment </li> <li> GNU make, version 4.0 or later </li> <li> <a href="http://skarnet.org/software/skalibs/">skalibs</a> version -2.3.6.1 or later. It's a build-time requirement. It's also a run-time +2.3.7.1 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> </ul> @@ -48,7 +48,7 @@ library. </li> <h3> Download </h3> <ul> - <li> The current released version of s6-linux-utils is <a href="s6-linux-utils-2.0.2.2.tar.gz">2.0.2.2</a>. </li> + <li> The current released version of s6-linux-utils is <a href="s6-linux-utils-2.0.2.3.tar.gz">2.0.2.3</a>. </li> <li> Alternatively, you can checkout a copy of the s6-linux-utils git repository: <pre> git clone git://git.skarnet.org/s6-linux-utils </pre> </li> </ul> diff --git a/doc/upgrade.html b/doc/upgrade.html index 3c476ab..71a4ecf 100644 --- a/doc/upgrade.html +++ b/doc/upgrade.html @@ -18,6 +18,12 @@ <h1> What has changed in s6-linux-utils </h1> +<h2> in 2.0.2.3 </h2> + +<ul> + <li> skalibs dependency bumped to 2.3.7.1 </li> +</ul> + <h2> in 2.0.2.2 </h2> <ul> diff --git a/package/info b/package/info index 2dabc3f..d81be7d 100644 --- a/package/info +++ b/package/info @@ -1,4 +1,4 @@ package=s6-linux-utils -version=2.0.2.2 +version=2.0.2.3 category=admin package_macro_name=S6_LINUX_UTILS diff --git a/src/minutils/s6-hiercopy.c b/src/minutils/s6-hiercopy.c deleted file mode 100644 index f8b7666..0000000 --- a/src/minutils/s6-hiercopy.c +++ /dev/null @@ -1,156 +0,0 @@ -/* ISC license. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <errno.h> -#include <fcntl.h> -#include <skalibs/bytestr.h> -#include <skalibs/strerr2.h> -#include <skalibs/stralloc.h> -#include <skalibs/djbunix.h> -#include <skalibs/direntry.h> -#include <skalibs/skamisc.h> - -#define USAGE "s6-hiercopy src dst" - -static void hiercopy (char const *, char const *) ; - -static int filecopy (char const *src, char const *dst, mode_t mode) -{ - int d ; - int s = open_readb(src) ; - if (s < 0) return 0 ; - d = open3(dst, O_WRONLY | O_CREAT | O_TRUNC, mode) ; - if (d < 0) - { - fd_close(s) ; - return 0 ; - } - if (fd_cat(s, d) < 0) goto err ; - fd_close(s) ; - fd_close(d) ; - return 1 ; - -err: - { - register int e = errno ; - fd_close(s) ; - fd_close(d) ; - errno = e ; - } - return 0 ; -} - -static int dircopy (char const *src, char const *dst, mode_t mode) -{ - unsigned int tmpbase = satmp.len ; - unsigned int maxlen = 0 ; - { - DIR *dir = opendir(src) ; - if (!dir) return 0 ; - for (;;) - { - direntry *d ; - register unsigned int n ; - errno = 0 ; - d = readdir(dir) ; - if (!d) break ; - if (d->d_name[0] == '.') - if (((d->d_name[1] == '.') && !d->d_name[2]) || !d->d_name[1]) - continue ; - n = str_len(d->d_name) ; - if (n > maxlen) maxlen = n ; - if (!stralloc_catb(&satmp, d->d_name, n+1)) break ; - } - if (errno) - { - int e = errno ; - dir_close(dir) ; - errno = e ; - goto err ; - } - dir_close(dir) ; - } - - if (mkdir(dst, S_IRWXU) == -1) - { - struct stat st ; - if (errno != EEXIST) goto err ; - if (stat(dst, &st) < 0) goto err ; - if (!S_ISDIR(st.st_mode)) { errno = ENOTDIR ; goto err ; } - } - - { - unsigned int srclen = str_len(src) ; - unsigned int dstlen = str_len(dst) ; - unsigned int i = tmpbase ; - char srcbuf[srclen + maxlen + 2] ; - char dstbuf[dstlen + maxlen + 2] ; - byte_copy(srcbuf, srclen, src) ; - byte_copy(dstbuf, dstlen, dst) ; - srcbuf[srclen] = '/' ; - dstbuf[dstlen] = '/' ; - while (i < satmp.len) - { - register unsigned int n = str_len(satmp.s + i) + 1 ; - byte_copy(srcbuf + srclen + 1, n, satmp.s + i) ; - byte_copy(dstbuf + dstlen + 1, n, satmp.s + i) ; - i += n ; - hiercopy(srcbuf, dstbuf) ; - } - } - if (chmod(dst, mode) == -1) goto err ; - satmp.len = tmpbase ; - return 1 ; -err: - satmp.len = tmpbase ; - return 0 ; -} - -static void hiercopy (char const *src, char const *dst) -{ - struct stat st ; - if (lstat(src, &st) == -1) strerr_diefu2sys(111, "stat ", src) ; - if (S_ISREG(st.st_mode)) - { - if (!filecopy(src, dst, st.st_mode)) - strerr_diefu4sys(111, "copy regular file ", src, " to ", dst) ; - } - else if (S_ISDIR(st.st_mode)) - { - if (!dircopy(src, dst, st.st_mode)) - strerr_diefu4sys(111, "recursively copy directory ", src, " to ", dst) ; - } - else if (S_ISFIFO(st.st_mode)) - { - if (mkfifo(dst, st.st_mode) < 0) - strerr_diefu2sys(111, "mkfifo ", dst) ; - } - else if (S_ISLNK(st.st_mode)) - { - unsigned int tmpbase = satmp.len ; - if ((sareadlink(&satmp, src) < 0) || !stralloc_0(&satmp)) - strerr_diefu2sys(111, "readlink ", src) ; - if (symlink(satmp.s + tmpbase, dst) < 0) - strerr_diefu4sys(111, "symlink ", satmp.s + tmpbase, " to ", dst) ; - satmp.len = tmpbase ; - } - else if (S_ISCHR(st.st_mode) || S_ISBLK(st.st_mode) || S_ISSOCK(st.st_mode)) - { - if (mknod(dst, st.st_mode, st.st_rdev) < 0) - strerr_diefu2sys(111, "mknod ", dst) ; - } - else strerr_dief2x(111, "unrecognized file type for ", src) ; - lchown(dst, st.st_uid, st.st_gid) ; - if (!S_ISLNK(st.st_mode)) chmod(dst, st.st_mode) ; -} - -int main (int argc, char const *const *argv) -{ - PROG = "s6-hiercopy" ; - if (argc < 3) strerr_dieusage(100, USAGE) ; - umask(0) ; - hiercopy(argv[1], argv[2]) ; - return 0 ; -} diff --git a/src/minutils/s6ps_otree.c b/src/minutils/s6ps_otree.c index 562a66d..b5f72b4 100644 --- a/src/minutils/s6ps_otree.c +++ b/src/minutils/s6ps_otree.c @@ -82,7 +82,7 @@ void s6ps_otree (pscan_t *p, unsigned int n, avltreen *pidtree, unsigned int *or } /* If we have init, make it the last in the orphan list */ - if (p[childlist[childindex[n-1]+1]].pid == 1) + if (n > 1 && p[childlist[childindex[n-1]+1]].pid == 1) { unsigned int pos1 = childlist[childindex[n-1] + 1] ; for (i = 2 ; i < nchild[n-1] ; i++) |