From c365aeb0721d3749bb5f94f09a3ad97ec6131805 Mon Sep 17 00:00:00 2001 From: Laurent Bercot Date: Wed, 27 Sep 2017 20:16:01 +0000 Subject: Rewrite openwrite(v)nclose using mkstemp --- src/libunixonacid/openwritenclose.c | 9 ------- src/libunixonacid/openwritenclose_devino.c | 9 ------- src/libunixonacid/openwritenclose_devino_tmp.c | 37 -------------------------- src/libunixonacid/openwritenclose_tmp.c | 11 -------- 4 files changed, 66 deletions(-) delete mode 100644 src/libunixonacid/openwritenclose.c delete mode 100644 src/libunixonacid/openwritenclose_devino.c delete mode 100644 src/libunixonacid/openwritenclose_devino_tmp.c delete mode 100644 src/libunixonacid/openwritenclose_tmp.c (limited to 'src/libunixonacid') diff --git a/src/libunixonacid/openwritenclose.c b/src/libunixonacid/openwritenclose.c deleted file mode 100644 index d8dc174..0000000 --- a/src/libunixonacid/openwritenclose.c +++ /dev/null @@ -1,9 +0,0 @@ -/* ISC license. */ - -#include -#include - -int openwritenclose (char const *fn, char const *s, size_t len) -{ - return openwritenclose_tmp(fn, s, len, &satmp) ; -} diff --git a/src/libunixonacid/openwritenclose_devino.c b/src/libunixonacid/openwritenclose_devino.c deleted file mode 100644 index 5a9c38d..0000000 --- a/src/libunixonacid/openwritenclose_devino.c +++ /dev/null @@ -1,9 +0,0 @@ -/* ISC license. */ - -#include -#include - -int openwritenclose_devino (char const *fn, char const *s, size_t len, dev_t *dev, ino_t *ino) -{ - return openwritenclose_devino_tmp(fn, s, len, dev, ino, &satmp) ; -} diff --git a/src/libunixonacid/openwritenclose_devino_tmp.c b/src/libunixonacid/openwritenclose_devino_tmp.c deleted file mode 100644 index 49eec93..0000000 --- a/src/libunixonacid/openwritenclose_devino_tmp.c +++ /dev/null @@ -1,37 +0,0 @@ -/* ISC license. */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -int openwritenclose_devino_tmp (char const *fn, char const *s, size_t len, dev_t *dev, ino_t *ino, stralloc *tmp) -{ - dev_t tmpdev ; - ino_t tmpino ; - size_t base = tmp->len ; - if (!stralloc_cats(tmp, fn)) return 0 ; - if (!random_sauniquename(tmp, 8)) goto fail ; - if (!stralloc_0(tmp)) goto fail ; - if (!openwritenclose_unsafe_devino_sync(tmp->s + base, s, len, &tmpdev, &tmpino)) goto fail ; - if (rename(tmp->s + base, fn) < 0) - { - int e = errno ; - unlink(tmp->s + base) ; - errno = e ; - goto fail ; - } - tmp->len = base ; - *dev = tmpdev ; - *ino = tmpino ; - return 1 ; - - fail: - tmp->len = base ; - return 0 ; -} diff --git a/src/libunixonacid/openwritenclose_tmp.c b/src/libunixonacid/openwritenclose_tmp.c deleted file mode 100644 index a8cb78f..0000000 --- a/src/libunixonacid/openwritenclose_tmp.c +++ /dev/null @@ -1,11 +0,0 @@ -/* ISC license. */ - -#include -#include - -int openwritenclose_tmp (char const *fn, char const *s, size_t len, stralloc *tmp) -{ - dev_t dev ; - ino_t ino ; - return openwritenclose_devino_tmp(fn, s, len, &dev, &ino, tmp) ; -} -- cgit v1.2.3