Reduce gcc warnings. No functional changes.

This commit is contained in:
matthieu 2015-11-11 21:20:12 +00:00
parent 300ba5c057
commit 27549fce93
3 changed files with 38 additions and 9 deletions

View File

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

View File

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

24
app/xconsole/xconsole.h Normal file
View File

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