From 27549fce93b37ecfc9ac0bf9c9bb696a41eca752 Mon Sep 17 00:00:00 2001 From: matthieu Date: Wed, 11 Nov 2015 21:20:12 +0000 Subject: [PATCH] Reduce gcc warnings. No functional changes. --- app/xconsole/privsep.c | 19 +++++++++++++------ app/xconsole/xconsole.c | 4 +--- app/xconsole/xconsole.h | 24 ++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 9 deletions(-) create mode 100644 app/xconsole/xconsole.h diff --git a/app/xconsole/privsep.c b/app/xconsole/privsep.c index 3b04e8827..fba7e648a 100644 --- a/app/xconsole/privsep.c +++ b/app/xconsole/privsep.c @@ -1,4 +1,4 @@ -/* $OpenBSD: privsep.c,v 1.5 2015/11/11 21:18:13 matthieu Exp $ */ +/* $OpenBSD: privsep.c,v 1.6 2015/11/11 21:20:12 matthieu Exp $ */ /* * Copyright 2001 Niels Provos * All rights reserved. @@ -30,6 +30,11 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include #include #include @@ -51,6 +56,8 @@ #inlude #endif +#include "xconsole.h" + enum cmd_types { PRIV_OPEN_PTY, PRIV_REDIRECT_CONSOLE, @@ -60,7 +67,7 @@ enum cmd_types { static int priv_fd = -1; static void -send_fd(int socket, int fd) +send_fd(int s, int fd) { struct msghdr msg; union { @@ -91,15 +98,15 @@ send_fd(int socket, int fd) msg.msg_iov = &vec; msg.msg_iovlen = 1; - if ((n = sendmsg(socket, &msg, 0)) == -1) - warn("%s: sendmsg(%d)", __func__, socket); + if ((n = sendmsg(s, &msg, 0)) == -1) + warn("%s: sendmsg(%d)", __func__, s); if (n != sizeof(int)) warnx("%s: sendmsg: expected sent 1 got %ld", __func__, (long)n); } static int -receive_fd(int socket) +receive_fd(int s) { struct msghdr msg; union { @@ -120,7 +127,7 @@ receive_fd(int socket) msg.msg_control = &cmsgbuf.buf; msg.msg_controllen = sizeof(cmsgbuf.buf); - if ((n = recvmsg(socket, &msg, 0)) == -1) + if ((n = recvmsg(s, &msg, 0)) == -1) warn("%s: recvmsg", __func__); if (n != sizeof(int)) warnx("%s: recvmsg: expected received 1 got %ld", diff --git a/app/xconsole/xconsole.c b/app/xconsole/xconsole.c index 0666b52b5..6aa84c058 100644 --- a/app/xconsole/xconsole.c +++ b/app/xconsole/xconsole.c @@ -79,9 +79,7 @@ extern char *_XawTextGetSTRING(TextWidget ctx, XawTextPosition left, #ifdef USE_PRIVSEP #include -extern int priv_init(uid_t, gid_t); -extern int priv_openpty(int *, int *); -extern int priv_set_console(int); +#include "xconsole.h" #endif static void inputReady(XtPointer w, int *source, XtInputId *id); diff --git a/app/xconsole/xconsole.h b/app/xconsole/xconsole.h new file mode 100644 index 000000000..a8dcbbd42 --- /dev/null +++ b/app/xconsole/xconsole.h @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2015 Matthieu Herrb + * + * Permission to use, copy, modify, and distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES + * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR + * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef _XCONSOLE_H +#define _XCONSOLE_H + +extern int priv_init(uid_t, gid_t); +extern int priv_openpty(int *, int *); +extern int priv_set_console(int); + +#endif