AC_CHECK_FUNCS(pthread_create)
fi
+AM_CONDITIONAL(BUILD_READPASSPHRASE_C, test x$ac_cv_func_readpassphrase = xno && test $bwin32 = false)
+
dnl ------------------------------------------------------
dnl Where do you live, libevent? And how do we call you?
threads_impl_source=src/common/compat_winthreads.c
endif
+if BUILD_READPASSPHRASE_C
+readpassphrase_source=src/ext/readpassphrase.c
+else
+readpassphrase_source=
+endif
+
LIBOR_A_SOURCES = \
src/common/address.c \
src/common/backtrace.c \
src/ext/csiphash.c \
src/ext/trunnel/trunnel.c \
$(libor_extra_source) \
- $(threads_impl_source)
+ $(threads_impl_source) \
+ $(readpassphrase_source)
src/common/log.o: micro-revision.i
/* OPENBSD ORIGINAL: lib/libc/gen/readpassphrase.c */
-#include "includes.h"
+#include "orconfig.h"
#ifndef HAVE_READPASSPHRASE
#include <string.h>
#include <unistd.h>
+#ifndef _PATH_TTY
+# define _PATH_TTY "/dev/tty"
+#endif
+
#ifdef TCSASOFT
# define _T_FLUSH (TCSAFLUSH|TCSASOFT)
#else
char *
readpassphrase(const char *prompt, char *buf, size_t bufsiz, int flags)
{
+ ssize_t bytes_written = 0;
ssize_t nr;
int input, output, save_errno, i, need_restart;
char ch, *p, *end;
/* No I/O if we are already backgrounded. */
if (signo[SIGTTOU] != 1 && signo[SIGTTIN] != 1) {
if (!(flags & RPP_STDIN))
- (void)write(output, prompt, strlen(prompt));
+ bytes_written = write(output, prompt, strlen(prompt));
end = buf + bufsiz - 1;
p = buf;
while ((nr = read(input, &ch, 1)) == 1 && ch != '\n' && ch != '\r') {
*p = '\0';
save_errno = errno;
if (!(term.c_lflag & ECHO))
- (void)write(output, "\n", 1);
+ bytes_written = write(output, "\n", 1);
}
+ (void) bytes_written;
+
/* Restore old terminal settings and signals. */
if (memcmp(&term, &oterm, sizeof(term)) != 0) {
while (tcsetattr(input, _T_FLUSH, &oterm) == -1 &&
#ifndef _READPASSPHRASE_H_
#define _READPASSPHRASE_H_
-#include "includes.h"
+#include "orconfig.h"
#ifndef HAVE_READPASSPHRASE
char * readpassphrase(const char *, char *, size_t, int);
+#define HAVE_READPASSPHRASE
+
#endif /* HAVE_READPASSPHRASE */
#endif /* !_READPASSPHRASE_H_ */