diff options
author | Laurent Bercot <ska-skaware@skarnet.org> | 2023-06-09 13:32:27 +0000 |
---|---|---|
committer | Laurent Bercot <ska@appnovation.com> | 2023-06-09 13:32:27 +0000 |
commit | c005b541bf9d54327ff860aad88367b854bae3d8 (patch) | |
tree | 6af88b1dd6637084b9e20e0c62b764656b9deaf4 /src/libstddjb/writenclose_unsafe.c | |
parent | 4af2899ac7ed0da49db7a6e94914fee391212f92 (diff) | |
download | skalibs-c005b541bf9d54327ff860aad88367b854bae3d8.tar.xz |
Add devino, refactor openwrite(v)nclose
Signed-off-by: Laurent Bercot <ska@appnovation.com>
Diffstat (limited to 'src/libstddjb/writenclose_unsafe.c')
-rw-r--r-- | src/libstddjb/writenclose_unsafe.c | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/src/libstddjb/writenclose_unsafe.c b/src/libstddjb/writenclose_unsafe.c deleted file mode 100644 index f71caea..0000000 --- a/src/libstddjb/writenclose_unsafe.c +++ /dev/null @@ -1,18 +0,0 @@ -/* ISC license. */ - -#include <sys/stat.h> -#include <errno.h> -#include <skalibs/allreadwrite.h> -#include <skalibs/djbunix.h> - -int writenclose_unsafe_internal (int fd, char const *s, size_t len, dev_t *dev, ino_t *ino, int dosync) -{ - struct stat st ; - if (allwrite(fd, s, len) < len) return 0 ; - if ((dev || ino) && (fstat(fd, &st) < 0)) return 0 ; - if (dosync && (fd_sync(fd) < 0) && (errno != EINVAL)) return 0 ; - fd_close(fd) ; - if (dev) *dev = st.st_dev ; - if (ino) *ino = st.st_ino ; - return 1 ; -} |