Remove unused mkstemp()
b82c231 "Remove -i option (#704)" removed its last usage in 2015.
Spotted while looking for code could potentially write/create/modify files.
This commit is contained in:
1 parent
f1bfd0c518
commit
77dcaf3fdc
3 files changed
-26
No files matched your search
@@ -45,7 +45,6 @@ if test "x$valgrind_cmd" = "x" ; then
|
|||||||
AC_MSG_WARN([valgrind is required to test jq.])
|
AC_MSG_WARN([valgrind is required to test jq.])
|
||||||
fi
|
fi
|
||||||
AC_CHECK_FUNCS(memmem)
|
AC_CHECK_FUNCS(memmem)
|
||||||
AC_CHECK_FUNCS(mkstemp)
|
|
||||||
|
|
||||||
AC_CHECK_HEADER("sys/cygwin.h", [have_cygwin=1;])
|
AC_CHECK_HEADER("sys/cygwin.h", [have_cygwin=1;])
|
||||||
AC_CHECK_HEADER("shlwapi.h",[have_shlwapi=1;])
|
AC_CHECK_HEADER("shlwapi.h",[have_shlwapi=1;])
|
||||||
|
|||||||
-21
@@ -79,27 +79,6 @@ FILE *fopen(const char *fname, const char *mode) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HAVE_MKSTEMP
|
|
||||||
int mkstemp(char *template) {
|
|
||||||
size_t len = strlen(template);
|
|
||||||
int tries=5;
|
|
||||||
int fd;
|
|
||||||
|
|
||||||
// mktemp() truncates template when it fails
|
|
||||||
char *s = alloca(len + 1);
|
|
||||||
assert(s != NULL);
|
|
||||||
strcpy(s, template);
|
|
||||||
|
|
||||||
do {
|
|
||||||
// Restore template
|
|
||||||
strcpy(template, s);
|
|
||||||
(void) mktemp(template);
|
|
||||||
fd = open(template, O_CREAT | O_EXCL | O_RDWR, 0600);
|
|
||||||
} while (fd == -1 && tries-- > 0);
|
|
||||||
return fd;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
jv expand_path(jv path) {
|
jv expand_path(jv path) {
|
||||||
assert(jv_get_kind(path) == JV_KIND_STRING);
|
assert(jv_get_kind(path) == JV_KIND_STRING);
|
||||||
const char *pstr = jv_string_value(path);
|
const char *pstr = jv_string_value(path);
|
||||||
|
|||||||
@@ -13,10 +13,6 @@
|
|||||||
|
|
||||||
#include "jv.h"
|
#include "jv.h"
|
||||||
|
|
||||||
#ifndef HAVE_MKSTEMP
|
|
||||||
int mkstemp(char *template);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
jv expand_path(jv);
|
jv expand_path(jv);
|
||||||
jv get_home(void);
|
jv get_home(void);
|
||||||
jv jq_realpath(jv);
|
jv jq_realpath(jv);
|
||||||
|
|||||||
Reference in new issue
Block a user