summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/include/skalibs/direntry.h2
-rw-r--r--src/include/skalibs/posixplz.h1
-rw-r--r--src/libposixplz/unlink_void.c12
-rw-r--r--src/libstddjb/dir_close.c15
-rw-r--r--src/libunixonacid/skaclient_end.c3
-rw-r--r--src/libunixonacid/textclient_end.c3
6 files changed, 28 insertions, 8 deletions
diff --git a/src/include/skalibs/direntry.h b/src/include/skalibs/direntry.h
index 70bd190..9f4615c 100644
--- 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
index 1e7692d..97c1ef1 100644
--- 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
new file mode 100644
index 0000000..472bd6a
--- /dev/null
+++ 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
index 1b7b16a..4c5d0cf 100644
--- 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
index 23dafab..1b24303 100644
--- 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
index 58fc930..1ddf93f 100644
--- 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 ;
}