skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

commit 0a181fc1b38a62e583f13ccc1550f7ffc8f5896b
parent f09ad31e00c22086863b95d3b6cb8eeadfdcdef7
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Sat, 21 Jul 2018 07:28:05 +0000

 Add unlink_void, change dir_close, prepare for 2.7.0.0

Diffstat:
MNEWS | 5+++--
Mdoc/index.html | 2+-
Mdoc/upgrade.html | 6++++--
Mpackage/deps.mak | 1+
Mpackage/info | 2+-
Msrc/include/skalibs/direntry.h | 2+-
Msrc/include/skalibs/posixplz.h | 1+
Asrc/libposixplz/unlink_void.c | 12++++++++++++
Msrc/libstddjb/dir_close.c | 15++++++++-------
Msrc/libunixonacid/skaclient_end.c | 3+++
Msrc/libunixonacid/textclient_end.c | 3+++
11 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/NEWS b/NEWS @@ -1,10 +1,11 @@ Changelog for skalibs. -In 2.6.5.0 +In 2.7.0.0 ---------- - Bugfixes. - - New function: ipc_timed_sendv() + - New functions: ipc_timed_sendv(), unlink_void() + - dir_close() now returns void and leaves errno unchanged In 2.6.4.0 diff --git a/doc/index.html b/doc/index.html @@ -60,7 +60,7 @@ with a standard C development environment </li> <h3> Download </h3> <ul> - <li> The current released version of skalibs is <a href="skalibs-2.6.5.0.tar.gz">2.6.5.0</a>. </li> + <li> The current released version of skalibs is <a href="skalibs-2.7.0.0.tar.gz">2.7.0.0</a>. </li> <li> Alternatively, you can checkout a copy of the <a href="//git.skarnet.org/cgi-bin/cgit.cgi/skalibs/">skalibs git repository</a>: diff --git a/doc/upgrade.html b/doc/upgrade.html @@ -16,10 +16,12 @@ <a href="//skarnet.org/">skarnet.org</a> </p> -<h2> in 2.6.5.0 </h2> +<h2> in 2.7.0.0 </h2> <ul> - <li> New function: <tt>ipc_timed_sendv()</tt> </li> + <li> New functions: <tt>ipc_timed_sendv()</tt>, <tt>unlink_void()</tt> </li> + <li> The <a href="djbunix.html">dir_close()</a> function now returns void +and leaves errno unchanged. </li> </ul> <h2> in 2.6.4.0 </h2> diff --git a/package/deps.mak b/package/deps.mak @@ -148,6 +148,7 @@ src/libposixplz/memmem.o src/libposixplz/memmem.lo: src/libposixplz/memmem.c src src/libposixplz/setgroups.o src/libposixplz/setgroups.lo: src/libposixplz/setgroups.c src/include/skalibs/nonposix.h src/include/skalibs/setgroups.h src/include/skalibs/sysdeps.h src/libposixplz/strnlen.o src/libposixplz/strnlen.lo: src/libposixplz/strnlen.c src/include/skalibs/bytestr.h src/include/skalibs/posixplz.h src/include/skalibs/sysdeps.h src/libposixplz/touch.o src/libposixplz/touch.lo: src/libposixplz/touch.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/include/skalibs/posixplz.h src/include/skalibs/sysdeps.h +src/libposixplz/unlink_void.o src/libposixplz/unlink_void.lo: src/libposixplz/unlink_void.c src/include/skalibs/posixplz.h src/librandom/random_char.o src/librandom/random_char.lo: src/librandom/random_char.c src/include/skalibs/random.h src/librandom/random_finish.o src/librandom/random_finish.lo: src/librandom/random_finish.c src/include/skalibs/djbunix.h src/librandom/random-internal.h src/include/skalibs/random.h src/include/skalibs/sysdeps.h src/librandom/random_init.o src/librandom/random_init.lo: src/librandom/random_init.c src/include/skalibs/djbunix.h src/include/skalibs/nonposix.h src/librandom/random-internal.h src/include/skalibs/random.h src/include/skalibs/surf.h src/include/skalibs/sysdeps.h diff --git a/package/info b/package/info @@ -1,4 +1,4 @@ package=skalibs -version=2.6.5.0 +version=2.7.0.0 category=prog package_macro_name=SKALIBS diff --git a/src/include/skalibs/direntry.h b/src/include/skalibs/direntry.h @@ -7,7 +7,7 @@ typedef struct dirent direntry, direntry_t, *direntry_ref, *direntry_t_ref ; -extern int dir_close (DIR *) ; +extern void dir_close (DIR *) ; extern int dir_fd (DIR *) ; /* Solaris doesn't have dirfd() */ #endif diff --git a/src/include/skalibs/posixplz.h b/src/include/skalibs/posixplz.h @@ -40,6 +40,7 @@ extern int getpeereid (int, uid_t *, gid_t *) ; extern void execvep (char const *, char const *const *, char const *const *, char const *) ; extern void execvep_loose (char const *, char const *const *, char const *const *, char const *) ; +extern void unlink_void (char const *) ; extern pid_t doublefork (void) ; extern int touch (char const *) ; diff --git a/src/libposixplz/unlink_void.c b/src/libposixplz/unlink_void.c @@ -0,0 +1,12 @@ +/* ISC license. */ + +#include <unistd.h> +#include <errno.h> +#include <skalibs/posixplz.h> + +void unlink_void (char const *file) +{ + int e = errno ; + unlink(file) ; + errno = e ; +} diff --git a/src/libstddjb/dir_close.c b/src/libstddjb/dir_close.c @@ -3,12 +3,13 @@ #include <errno.h> #include <skalibs/direntry.h> -int dir_close (DIR *dir) +void dir_close (DIR *dir) { - unsigned int done = 0 ; -doit: - done++ ; - if (!closedir(dir)) return 0 ; - if (errno == EINTR) goto doit ; - return ((errno == EBADF) && (done > 1)) ? 0 : -1 ; + int e = errno ; + for (;;) + { + if (closedir(dir) == 0) break ; + if (errno != EINTR) break ; + } + errno = e ; } diff --git a/src/libunixonacid/skaclient_end.c b/src/libunixonacid/skaclient_end.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include <errno.h> #include <skalibs/djbunix.h> #include <skalibs/skaclient.h> #include <skalibs/unixmessage.h> @@ -14,8 +15,10 @@ void skaclient_end (skaclient_t *a) unixmessage_receiver_free(&a->asyncin) ; if (a->pid && a->options & SKACLIENT_OPTION_WAITPID) { + int e = errno ; int wstat ; waitpid_nointr(a->pid, &wstat, 0) ; + errno = e ; } *a = skaclient_zero ; } diff --git a/src/libunixonacid/textclient_end.c b/src/libunixonacid/textclient_end.c @@ -1,5 +1,6 @@ /* ISC license. */ +#include <errno.h> #include <skalibs/djbunix.h> #include <skalibs/textmessage.h> #include <skalibs/textclient.h> @@ -15,8 +16,10 @@ void textclient_end (textclient_t *a) textmessage_receiver_free(&a->asyncin) ; if (a->pid && a->options & TEXTCLIENT_OPTION_WAITPID) { + int e = errno ; int wstat ; waitpid_nointr(a->pid, &wstat, 0) ; + errno = e ; } *a = textclient_zero ; }