summaryrefslogtreecommitdiff
path: root/app/xconsole
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2015-11-11 21:20:13 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2015-11-11 21:20:13 +0000
commitab1742678cd1cf3c8329ceb1cd05b0d8698b82cf (patch)
treef9b2c5f8f3ded1db86a86f095ec637b9ae6d717d /app/xconsole
parenta9f13f57c7a69d6c195de4b347c3fef379eb9c3f (diff)
Reduce gcc warnings. No functional changes.
Diffstat (limited to 'app/xconsole')
-rw-r--r--app/xconsole/privsep.c19
-rw-r--r--app/xconsole/xconsole.c4
-rw-r--r--app/xconsole/xconsole.h24
3 files changed, 38 insertions, 9 deletions
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 <provos@citi.umich.edu>
* 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 <sys/ioctl.h>
#include <sys/param.h>
#include <sys/uio.h>
@@ -51,6 +56,8 @@
#inlude <pty.h>
#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 <pwd.h>
-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 <matthieu@herrb.eu>
+ *
+ * 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