The vreboot utility is used to send the signal from the vserver
environment.
*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+#include "pathconfig.h"
+
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <sys/types.h>
+#include <limits.h>
#include <errno.h>
#include <syslog.h>
#include <sys/stat.h>
int ret = -1;
char sockn[PATH_MAX];
int fd = socket (AF_UNIX,SOCK_STREAM,0);
- sprintf (sockn,"/vservers/%s/dev/reboot",vname);
+ sprintf (sockn, DEFAULT_VSERVERDIR "/%s/dev/reboot",vname);
unlink (sockn);
if (fd == -1){
fprintf (stderr,"Can't create a unix domain socket (%s)\n"
if (strcmp(buf,"reboot\n")==0){
char cmd[1000];
syslog (LOG_NOTICE,"reboot vserver %s\n",vname);
- snprintf (cmd,sizeof(cmd)-1,"/usr/sbin/vserver %s restart >>/var/log/boot.log 2>&1",vname);
+ snprintf (cmd,sizeof(cmd)-1, SBINDIR "/vserver %s restart >>/var/log/boot.log 2>&1", vname);
system (cmd);
ret = 0;
}else if (strcmp(buf,"halt\n")==0){
char cmd[1000];
syslog (LOG_NOTICE,"halt vserver %s\n",vname);
- snprintf (cmd,sizeof(cmd)-1,"/usr/sbin/vserver %s stop >>/var/log/boot.log 2>&1",vname);
+ snprintf (cmd,sizeof(cmd)-1, SBINDIR "/vserver %s stop >>/var/log/boot.log 2>&1", vname);
system (cmd);
ret = 0;
}else{
int fd = sockets[i];
if (FD_ISSET(fd,&fdin)){
struct sockaddr_un unc;
- size_t len = sizeof(unc);
+ socklen_t len = sizeof(unc);
unc.sun_family = AF_UNIX;
fd = accept (fd,(struct sockaddr*)&unc,&len);
if (fd != -1){