-/* $OpenBSD: privsep.c,v 1.12 2014/07/12 20:07:07 yasuoka Exp $ */
+/* $OpenBSD: privsep.c,v 1.13 2014/07/13 21:34:35 yasuoka Exp $ */
/*
* Copyright (c) 2010 Yasuoka Masahiko <yasuoka@openbsd.org>
errno = EINVAL;
return (-1);
}
+ if ((sock = dup(sock)) == -1)
+ return (-1);
+
memcpy(&a.name, name, namelen);
a.namelen = namelen;
errno = EINVAL;
return (-1);
}
+ if ((s = dup(s)) == -1)
+ return (-1);
a.len = len;
a.flags = flags;
(void)imsg_compose(ibuf, PRIVSEP_OK, 0, 0, f,
&r, sizeof(r));
imsg_flush(ibuf);
- close(f);
}
break;
case PRIVSEP_SOCKET: {
(void)imsg_compose(ibuf, PRIVSEP_OK, 0, 0, s,
&r, sizeof(r));
imsg_flush(ibuf);
- close(s);
}
break;
case PRIVSEP_UNLINK: {