[log.c scp.c sshd.c serverloop.c schnorr.c sftp.c]
     Fix some "unused result" warnings found via clang and -portable.
     ok markus@
This commit is contained in:
Darren Tucker 2013-05-16 20:32:29 +10:00
parent 64d22946d6
commit dbee308253
7 changed files with 22 additions and 15 deletions

View File

@ -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

4
log.c
View File

@ -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 @@ do_log(LogLevel level, const char *fmt, va_list args)
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);

View File

@ -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 @@ debug3_bn(const BIGNUM *n, const char *fmt, ...)
{
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 @@ debug3_buf(const u_char *buf, u_int len, const char *fmt, ...)
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)" : "");

4
scp.c
View File

@ -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 @@ void
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

View File

@ -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 @@ static void
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)

4
sftp.c
View File

@ -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 @@ cmd_interrupt(int signo)
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;
}

5
sshd.c
View File

@ -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 @@ main(int ac, char **av)
/* 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);