add an extension method "posix-rename@openssh.com" to perform POSIX atomic
rename() operations. based on patch from miklos AT szeredi.hu in bz#1400;
ok dtucker@ markus@
+ - deraadt@cvs.openbsd.org 2008/03/02 18:19:35
+ [monitor_fdpass.c]
+ use a union to ensure alignment of the cmsg (pay attention: various other
+ parts of the tree need this treatment too); ok djm
20080302
- (dtucker) [configure.ac] FreeBSD's glob() doesn't behave the way we expect
-/* $OpenBSD: monitor_fdpass.c,v 1.13 2007/09/04 03:21:03 djm Exp $ */
+/* $OpenBSD: monitor_fdpass.c,v 1.14 2008/03/02 18:19:35 deraadt Exp $ */
/*
* Copyright 2001 Niels Provos <provos@citi.umich.edu>
* All rights reserved.
char ch = '\0';
ssize_t n;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
- char tmp[CMSG_SPACE(sizeof(int))];
+ union {
+ struct cmsghdr hdr;
+ char tmp[CMSG_SPACE(sizeof(int))];
+ } tmp;
struct cmsghdr *cmsg;
#endif
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
- msg.msg_control = (caddr_t)tmp;
+ msg.msg_control = (caddr_t)&tmp;
msg.msg_controllen = CMSG_LEN(sizeof(int));
cmsg = CMSG_FIRSTHDR(&msg);
cmsg->cmsg_len = CMSG_LEN(sizeof(int));
char ch;
int fd;
#ifndef HAVE_ACCRIGHTS_IN_MSGHDR
- char tmp[CMSG_SPACE(sizeof(int))];
+ union {
+ char tmp[CMSG_SPACE(sizeof(int))];
+ struct cmsghdr hdr;
+ } tmp;
struct cmsghdr *cmsg;
#endif
msg.msg_accrights = (caddr_t)&fd;
msg.msg_accrightslen = sizeof(fd);
#else
- msg.msg_control = tmp;
+ msg.msg_control = &tmp;
msg.msg_controllen = sizeof(tmp);
#endif