main(int argc, char *argv[])
{
int fd_userns = \-1;
+ int fd_tree;
int index = 0;
int ret;
bool recursive = false;
+ const char *source;
+ const char *target;
struct mount_attr *attr = &(struct mount_attr){};
while ((ret = getopt_long_only(argc, argv, "",
if ((argc \- optind) < 2)
errx(EXIT_FAILURE, "Missing source or target mount point");
- const char *source = argv[optind];
- const char *target = argv[optind + 1];
+ source = argv[optind];
+ target = argv[optind + 1];
/* In the following, \-1 as the \(aqdirfd\(aq argument ensures that
open_tree() fails if \(aqsource\(aq is not an absolute pathname. */
.\" If I can't operate based on a well-known dirfd I use absolute paths
.\" with a -EBADF dirfd passed to *at() functions.
- int fd_tree = open_tree(\-1, source,
- OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC |
- AT_EMPTY_PATH | (recursive ? AT_RECURSIVE : 0));
+ fd_tree = open_tree(\-1, source,
+ OPEN_TREE_CLONE | OPEN_TREE_CLOEXEC |
+ AT_EMPTY_PATH | (recursive ? AT_RECURSIVE : 0));
if (fd_tree == \-1)
err(EXIT_FAILURE, "open(%s)", source);
/* Read datagrams and echo them back to sender. */
for (;;) {
+ char host[NI_MAXHOST], service[NI_MAXSERV];
+
peer_addrlen = sizeof(peer_addr);
nread = recvfrom(sfd, buf, BUF_SIZE, 0,
(struct sockaddr *) &peer_addr, &peer_addrlen);
if (nread == \-1)
continue; /* Ignore failed request */
- char host[NI_MAXHOST], service[NI_MAXSERV];
-
s = getnameinfo((struct sockaddr *) &peer_addr,
peer_addrlen, host, NI_MAXHOST,
service, NI_MAXSERV, NI_NUMERICSERV);
int
main(void)
{
- int **val;
+ int *ptr;
+ int **val;
srand(time(NULL));
for (unsigned int i = 0; i < 12; i++) {
- int *ptr = xmalloc(sizeof(*ptr));
+ ptr = xmalloc(sizeof(*ptr));
*ptr = rand() & 0xff;
val = tsearch(ptr, &root, compare);
if (val == NULL)