diff --git a/helpers.c b/helpers.c index 7757eab8..f6c49737 100644 --- a/helpers.c +++ b/helpers.c @@ -1,4 +1,4 @@ -/* Misc. utility functions and C-library extensions for finit and its plugins +/* Misc. utility functions for finit and its plugins * * Copyright (c) 2008-2010 Claudio Matsuoka * Copyright (c) 2008-2015 Joachim Nilsson @@ -40,69 +40,6 @@ #include "libite/lite.h" -/* - * Helpers to replace system() calls - */ - -int makepath(char *path) -{ - char buf[PATH_MAX]; - char *x = buf; - int ret; - - if (!path) { - errno = EINVAL; - return -1; - } - - do { - do { - *x++ = *path++; - } while (*path && *path != '/'); - - *x = 0; - ret = mkdir(buf, 0777); - } while (*path && (*path != '/' || *(path + 1))); /* ignore trailing slash */ - - return ret; -} - -void ifconfig(char *ifname, char *addr, char *mask, int up) -{ - struct ifreq ifr; - struct sockaddr_in *a = (struct sockaddr_in *)&ifr.ifr_addr; - int sock; - - if ((sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP)) < 0) - return; - - memset(&ifr, 0, sizeof (ifr)); - strlcpy(ifr.ifr_name, ifname, IFNAMSIZ); - ifr.ifr_addr.sa_family = AF_INET; - - if (up) { - if (addr) { - inet_aton(addr, &a->sin_addr); - ioctl(sock, SIOCSIFADDR, &ifr); - } - if (mask) { - inet_aton(mask, &a->sin_addr); - ioctl(sock, SIOCSIFNETMASK, &ifr); - } - } - - ioctl(sock, SIOCGIFFLAGS, &ifr); - - if (up) - ifr.ifr_flags |= IFF_UP; - else - ifr.ifr_flags &= ~IFF_UP; - - ioctl(sock, SIOCSIFFLAGS, &ifr); - - close(sock); -} - /** * atonum - Convert string to integer * @str: String value to convert. diff --git a/helpers.h b/helpers.h index 80648c05..03a9aeb8 100644 --- a/helpers.h +++ b/helpers.h @@ -65,9 +65,6 @@ do { \ #define SETBIT(a,i) (a |= (1 << (i))) #define CLRBIT(a,i) (a &= ~(1 << (i))) -int makepath (char *path); -void ifconfig (char *ifname, char *addr, char *mask, int up); - int atonum (char *str); void runlevel_set (int pre, int now); diff --git a/libite b/libite index 8db31462..4005dd5e 160000 --- a/libite +++ b/libite @@ -1 +1 @@ -Subproject commit 8db314623a682913cf565835ff3326a81cc609b9 +Subproject commit 4005dd5e2c1dccb90a12aa8796cac752b33a2ca2