summaryrefslogtreecommitdiff
path: root/src/skaembutils/seekablepipe.c
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2020-11-30 12:28:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2020-11-30 12:28:04 +0000
commit438ec28cb8b88f392ca7b0c13447bd021810a564 (patch)
tree20fb94e28b7b2e71dd1a13089af05d3f21ab8fb7 /src/skaembutils/seekablepipe.c
parenta59bebeba589dba1a0246925b47688b722cfe68c (diff)
downloads6-portable-utils-438ec28cb8b88f392ca7b0c13447bd021810a564.tar.xz
Prepare for 2.2.3.1, adapt to skalibs-2.10.0.0
Diffstat (limited to 'src/skaembutils/seekablepipe.c')
-rw-r--r--src/skaembutils/seekablepipe.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/skaembutils/seekablepipe.c b/src/skaembutils/seekablepipe.c
index 419be78..c2f5f48 100644
--- a/src/skaembutils/seekablepipe.c
+++ b/src/skaembutils/seekablepipe.c
@@ -1,15 +1,18 @@
/* ISC license. */
#include <unistd.h>
+
+#include <skalibs/posixplz.h>
#include <skalibs/strerr2.h>
#include <skalibs/iobuffer.h>
#include <skalibs/djbunix.h>
+#include <skalibs/exec.h>
#define USAGE "seekablepipe tempfile prog..."
#define N 8192
-int main (int argc, char const *const *argv, char const *const *envp)
+int main (int argc, char const *const *argv)
{
iobuffer b ;
int fdr, fdw ;
@@ -22,8 +25,7 @@ int main (int argc, char const *const *argv, char const *const *envp)
fdr = open_readb(argv[1]) ;
if (fdr < 0)
strerr_diefu3sys(111, "open ", argv[1], " for reading") ;
- if (unlink(argv[1]) < 0)
- strerr_diefu2sys(111, "unlink ", argv[1]) ;
+ unlink_void(argv[1]) ;
if (ndelay_off(fdw) < 0)
strerr_diefu1sys(111, "set fdw blocking") ;
if (!iobuffer_init(&b, 0, fdw))
@@ -33,8 +35,8 @@ int main (int argc, char const *const *argv, char const *const *envp)
strerr_diefu2sys(111, "write to ", argv[1]) ;
if (r < 0) strerr_diefu1sys(111, "read from stdin") ;
iobuffer_finish(&b) ;
- fd_close(fdw) ;
+ close(fdw) ;
if (fd_move(0, fdr) < 0)
- strerr_diefu1sys(111, "move fdr to stdin") ;
- xpathexec_run(argv[2], argv+2, envp) ;
+ strerr_diefu1sys(111, "move temporary file descriptor") ;
+ xexec(argv+2) ;
}