Print this page
Reduce lint
*** 101,111 ****
/*
* Since a non-zero exit will cause the zone to reboot, a pause here
* will prevent a mis-configured zone from spinning in a reboot loop.
*/
! pause();
exit(1);
/*NOTREACHED*/
}
static void
--- 101,111 ----
/*
* Since a non-zero exit will cause the zone to reboot, a pause here
* will prevent a mis-configured zone from spinning in a reboot loop.
*/
! (void) pause();
exit(1);
/*NOTREACHED*/
}
static void
*** 202,224 ****
}
return (-1);
}
#endif /* XXX KEBE SAYS NOT YET */
! void
lxi_svc_start(char *name, char *path, char *fmri)
{
pid_t pid;
int status;
! char *const argv[] = {
! name,
NULL
};
! char *const envp[] = {
! fmri,
NULL
};
pid = fork();
if (pid == -1) {
lxi_err("fork() failed: %s", strerror(errno));
}
--- 202,226 ----
}
return (-1);
}
#endif /* XXX KEBE SAYS NOT YET */
! static void
lxi_svc_start(char *name, char *path, char *fmri)
{
pid_t pid;
int status;
! char *argv[] = {
! NULL,
NULL
};
! char *envp[] = {
! NULL,
NULL
};
+ argv[0] = name;
+ envp[0] = fmri;
pid = fork();
if (pid == -1) {
lxi_err("fork() failed: %s", strerror(errno));
}
*** 233,252 ****
* system root (e.g. "/native") if in use for this zone:
*/
(void) snprintf(cmd, sizeof (cmd), "%s%s", zroot != NULL ?
zroot : "", path);
! execve(cmd, argv, envp);
lxi_err("execve(%s) failed: %s", cmd, strerror(errno));
/* NOTREACHED */
}
/* parent */
! while (wait(&status) != pid) {
! /* EMPTY */;
! }
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0) {
lxi_err("%s[%d] exited: %d", name,
(int)pid, WEXITSTATUS(status));
--- 235,253 ----
* system root (e.g. "/native") if in use for this zone:
*/
(void) snprintf(cmd, sizeof (cmd), "%s%s", zroot != NULL ?
zroot : "", path);
! (void) execve(cmd, argv, envp);
lxi_err("execve(%s) failed: %s", cmd, strerror(errno));
/* NOTREACHED */
}
/* parent */
! while (wait(&status) != pid)
! ;
if (WIFEXITED(status)) {
if (WEXITSTATUS(status) != 0) {
lxi_err("%s[%d] exited: %d", name,
(int)pid, WEXITSTATUS(status));
*** 496,509 ****
static int
lxi_iface_gateway(const char *iface, const char *dst, int dstpfx,
const char *gwaddr)
{
int idx, len, sockfd;
! char rtbuf[RTMBUFSZ];
struct rt_msghdr *rtm = (struct rt_msghdr *)rtbuf;
! struct sockaddr_in *dst_sin = (struct sockaddr_in *)
! (rtbuf + sizeof (struct rt_msghdr));
struct sockaddr_in *gw_sin = (struct sockaddr_in *)(dst_sin + 1);
struct sockaddr_in *netmask_sin = (struct sockaddr_in *)(gw_sin + 1);
(void) bzero(rtm, RTMBUFSZ);
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
--- 497,510 ----
static int
lxi_iface_gateway(const char *iface, const char *dst, int dstpfx,
const char *gwaddr)
{
int idx, len, sockfd;
! /* For lint-happy alignment, use a uint32_t array... */
! uint32_t rtbuf[RTMBUFSZ / sizeof (uint32_t)];
struct rt_msghdr *rtm = (struct rt_msghdr *)rtbuf;
! struct sockaddr_in *dst_sin = (struct sockaddr_in *)(rtm + 1);
struct sockaddr_in *gw_sin = (struct sockaddr_in *)(dst_sin + 1);
struct sockaddr_in *netmask_sin = (struct sockaddr_in *)(gw_sin + 1);
(void) bzero(rtm, RTMBUFSZ);
rtm->rtm_addrs = RTA_DST | RTA_GATEWAY | RTA_NETMASK;
*** 551,569 ****
return (-1);
}
if ((len = write(sockfd, rtbuf, rtm->rtm_msglen)) < 0) {
lxi_warn("could not write rtmsg: %s", strerror(errno));
! close(sockfd);
return (-1);
} else if (len < rtm->rtm_msglen) {
lxi_warn("write() rtmsg incomplete");
! close(sockfd);
return (-1);
}
! close(sockfd);
return (0);
}
static void
lxi_net_loopback()
--- 552,570 ----
return (-1);
}
if ((len = write(sockfd, rtbuf, rtm->rtm_msglen)) < 0) {
lxi_warn("could not write rtmsg: %s", strerror(errno));
! (void) close(sockfd);
return (-1);
} else if (len < rtm->rtm_msglen) {
lxi_warn("write() rtmsg incomplete");
! (void) close(sockfd);
return (-1);
}
! (void) close(sockfd);
return (0);
}
static void
lxi_net_loopback()
*** 846,856 ****
* systemd uses the 'container' env var to determine it is running
* inside a container. It only supports a few well-known types and
* treats anything else as 'other' but this is enough to make it
* behave better inside a zone. See 'detect_container' in systemd.
*/
! execve(cmd, argv, envp);
e = errno;
/*
* Because stdout was closed prior to exec, it must be opened again in
* the face of failure to log the error.
--- 847,857 ----
* systemd uses the 'container' env var to determine it is running
* inside a container. It only supports a few well-known types and
* treats anything else as 'other' but this is enough to make it
* behave better inside a zone. See 'detect_container' in systemd.
*/
! (void) execve(cmd, argv, envp);
e = errno;
/*
* Because stdout was closed prior to exec, it must be opened again in
* the face of failure to log the error.