- dtucker@cvs.openbsd.org 2013/05/16 09:08:41
     [log.c scp.c sshd.c serverloop.c schnorr.c sftp.c]
     Fix some "unused result" warnings found via clang and -portable.
     ok markus@
diff --git a/ChangeLog b/ChangeLog
index e5cc7d5..cc59a47 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -43,6 +43,10 @@
    - jmc@cvs.openbsd.org 2013/05/16 06:30:06
      [sshd_config.5]
      oops! avoid Xr to self;
+   - dtucker@cvs.openbsd.org 2013/05/16 09:08:41
+     [log.c scp.c sshd.c serverloop.c schnorr.c sftp.c]
+     Fix some "unused result" warnings found via clang and -portable.
+     ok markus@
 
 20130510
  - (dtucker) [configure.ac] Enable -Wsizeof-pointer-memaccess if the compiler
diff --git a/log.c b/log.c
index 81497a4..32e1d2e 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.44 2013/04/07 02:10:33 dtucker Exp $ */
+/* $OpenBSD: log.c,v 1.45 2013/05/16 09:08:41 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -445,7 +445,7 @@
 		log_handler = tmp_handler;
 	} else if (log_on_stderr) {
 		snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
-		write(log_stderr_fd, msgbuf, strlen(msgbuf));
+		(void)write(log_stderr_fd, msgbuf, strlen(msgbuf));
 	} else {
 #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT)
 		openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
diff --git a/schnorr.c b/schnorr.c
index 4d54d68..05c2e77 100644
--- a/schnorr.c
+++ b/schnorr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: schnorr.c,v 1.5 2010/12/03 23:49:26 djm Exp $ */
+/* $OpenBSD: schnorr.c,v 1.6 2013/05/16 09:08:41 dtucker Exp $ */
 /*
  * Copyright (c) 2008 Damien Miller.  All rights reserved.
  *
@@ -488,12 +488,13 @@
 {
 	char *out, *h;
 	va_list args;
+	int ret;
 
 	out = NULL;
 	va_start(args, fmt);
-	vasprintf(&out, fmt, args);
+	ret = vasprintf(&out, fmt, args);
 	va_end(args);
-	if (out == NULL)
+	if (ret == -1 || out == NULL)
 		fatal("%s: vasprintf failed", __func__);
 
 	if (n == NULL)
@@ -513,12 +514,13 @@
 	char *out, h[65];
 	u_int i, j;
 	va_list args;
+	int ret;
 
 	out = NULL;
 	va_start(args, fmt);
-	vasprintf(&out, fmt, args);
+	ret = vasprintf(&out, fmt, args);
 	va_end(args);
-	if (out == NULL)
+	if (ret == -1 || out == NULL)
 		fatal("%s: vasprintf failed", __func__);
 
 	debug3("%s length %u%s", out, len, buf == NULL ? " (null)" : "");
diff --git a/scp.c b/scp.c
index 645d740..ae3d388 100644
--- a/scp.c
+++ b/scp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: scp.c,v 1.171 2011/09/09 22:37:01 djm Exp $ */
+/* $OpenBSD: scp.c,v 1.172 2013/05/16 09:08:41 dtucker Exp $ */
 /*
  * scp - secure remote copy.  This is basically patched BSD rcp which
  * uses ssh to do the data transfer (instead of using rcmd).
@@ -1325,7 +1325,7 @@
 lostconn(int signo)
 {
 	if (!iamremote)
-		write(STDERR_FILENO, "lost connection\n", 16);
+		(void)write(STDERR_FILENO, "lost connection\n", 16);
 	if (signo)
 		_exit(1);
 	else
diff --git a/serverloop.c b/serverloop.c
index 595899f..a61d4ad 100644
--- a/serverloop.c
+++ b/serverloop.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: serverloop.c,v 1.165 2013/05/16 04:09:14 dtucker Exp $ */
+/* $OpenBSD: serverloop.c,v 1.166 2013/05/16 09:08:41 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -148,7 +148,7 @@
 notify_parent(void)
 {
 	if (notify_pipe[1] != -1)
-		write(notify_pipe[1], "", 1);
+		(void)write(notify_pipe[1], "", 1);
 }
 static void
 notify_prepare(fd_set *readset)
diff --git a/sftp.c b/sftp.c
index 24396ef..12c4958 100644
--- a/sftp.c
+++ b/sftp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sftp.c,v 1.143 2013/04/18 02:16:07 djm Exp $ */
+/* $OpenBSD: sftp.c,v 1.144 2013/05/16 09:08:41 dtucker Exp $ */
 /*
  * Copyright (c) 2001-2004 Damien Miller <djm@openbsd.org>
  *
@@ -218,7 +218,7 @@
 	const char msg[] = "\rInterrupt  \n";
 	int olderrno = errno;
 
-	write(STDERR_FILENO, msg, sizeof(msg) - 1);
+	(void)write(STDERR_FILENO, msg, sizeof(msg) - 1);
 	interrupted = 1;
 	errno = olderrno;
 }
diff --git a/sshd.c b/sshd.c
index 9a8e7b8..df9d0d6 100644
--- a/sshd.c
+++ b/sshd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sshd.c,v 1.400 2013/05/16 04:09:14 dtucker Exp $ */
+/* $OpenBSD: sshd.c,v 1.401 2013/05/16 09:08:41 dtucker Exp $ */
 /*
  * Author: Tatu Ylonen <ylo@cs.hut.fi>
  * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1815,7 +1815,8 @@
 
 	/* Chdir to the root directory so that the current disk can be
 	   unmounted if desired. */
-	chdir("/");
+	if (chdir("/") == -1)
+		error("chdir(\"/\"): %s", strerror(errno));
 
 	/* ignore SIGPIPE */
 	signal(SIGPIPE, SIG_IGN);