Strangely, using // in the comments I added was not a persistent accident.
This commit is contained in:
parent
7ccf5cc064
commit
da9d1d079e
127
libbb/xfuncs.c
127
libbb/xfuncs.c
@ -21,7 +21,7 @@
|
|||||||
* included after these prototypes in libbb.h, all is well.
|
* included after these prototypes in libbb.h, all is well.
|
||||||
*/
|
*/
|
||||||
#ifdef L_xmalloc
|
#ifdef L_xmalloc
|
||||||
/* Die if we can't allocate size bytes of memory. */
|
// Die if we can't allocate size bytes of memory.
|
||||||
void *xmalloc(size_t size)
|
void *xmalloc(size_t size)
|
||||||
{
|
{
|
||||||
void *ptr = malloc(size);
|
void *ptr = malloc(size);
|
||||||
@ -32,9 +32,9 @@ void *xmalloc(size_t size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xrealloc
|
#ifdef L_xrealloc
|
||||||
/* Die if we can't resize previously allocated memory. (This returns a pointer
|
// Die if we can't resize previously allocated memory. (This returns a pointer
|
||||||
* to the new memory, which may or may not be the same as the old memory.
|
// to the new memory, which may or may not be the same as the old memory.
|
||||||
* It'll copy the contents to a new chunk and free the old one if necessary.) */
|
// It'll copy the contents to a new chunk and free the old one if necessary.)
|
||||||
void *xrealloc(void *ptr, size_t size)
|
void *xrealloc(void *ptr, size_t size)
|
||||||
{
|
{
|
||||||
ptr = realloc(ptr, size);
|
ptr = realloc(ptr, size);
|
||||||
@ -47,7 +47,7 @@ void *xrealloc(void *ptr, size_t size)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef L_xzalloc
|
#ifdef L_xzalloc
|
||||||
/* Die if we can't allocate and zero size bytes of memory. */
|
// Die if we can't allocate and zero size bytes of memory.
|
||||||
void *xzalloc(size_t size)
|
void *xzalloc(size_t size)
|
||||||
{
|
{
|
||||||
void *ptr = xmalloc(size);
|
void *ptr = xmalloc(size);
|
||||||
@ -57,7 +57,7 @@ void *xzalloc(size_t size)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xstrdup
|
#ifdef L_xstrdup
|
||||||
/* Die if we can't copy a string to freshly allocated memory. */
|
// Die if we can't copy a string to freshly allocated memory.
|
||||||
char * xstrdup(const char *s)
|
char * xstrdup(const char *s)
|
||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
@ -75,9 +75,8 @@ char * xstrdup(const char *s)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xstrndup
|
#ifdef L_xstrndup
|
||||||
/* Die if we can't allocate n+1 bytes (space for the null terminator) and copy
|
// Die if we can't allocate n+1 bytes (space for the null terminator) and copy
|
||||||
* the (possibly truncated to length n) string into it.
|
// the (possibly truncated to length n) string into it.
|
||||||
*/
|
|
||||||
char * xstrndup(const char *s, int n)
|
char * xstrndup(const char *s, int n)
|
||||||
{
|
{
|
||||||
char *t;
|
char *t;
|
||||||
@ -92,9 +91,8 @@ char * xstrndup(const char *s, int n)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xfopen
|
#ifdef L_xfopen
|
||||||
/* Die if we can't open a file and return a FILE * to it.
|
// Die if we can't open a file and return a FILE * to it.
|
||||||
* Notice we haven't got xfread(), This is for use with fscanf() and friends.
|
// Notice we haven't got xfread(), This is for use with fscanf() and friends.
|
||||||
*/
|
|
||||||
FILE *xfopen(const char *path, const char *mode)
|
FILE *xfopen(const char *path, const char *mode)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
@ -105,7 +103,7 @@ FILE *xfopen(const char *path, const char *mode)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xopen
|
#ifdef L_xopen
|
||||||
/* Die if we can't open an existing file and return an fd. */
|
// Die if we can't open an existing file and return an fd.
|
||||||
int xopen(const char *pathname, int flags)
|
int xopen(const char *pathname, int flags)
|
||||||
{
|
{
|
||||||
if (ENABLE_DEBUG && (flags & O_CREAT))
|
if (ENABLE_DEBUG && (flags & O_CREAT))
|
||||||
@ -116,7 +114,7 @@ int xopen(const char *pathname, int flags)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xopen3
|
#ifdef L_xopen3
|
||||||
/* Die if we can't open a new file and return an fd. */
|
// Die if we can't open a new file and return an fd.
|
||||||
int xopen3(const char *pathname, int flags, int mode)
|
int xopen3(const char *pathname, int flags, int mode)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
@ -130,7 +128,7 @@ int xopen3(const char *pathname, int flags, int mode)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xread
|
#ifdef L_xread
|
||||||
/* Die with an error message if we can't read the entire buffer. */
|
// Die with an error message if we can't read the entire buffer.
|
||||||
void xread(int fd, void *buf, size_t count)
|
void xread(int fd, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
while (count) {
|
while (count) {
|
||||||
@ -145,7 +143,7 @@ void xread(int fd, void *buf, size_t count)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xwrite
|
#ifdef L_xwrite
|
||||||
/* Die with an error message if we can't write the entire buffer. */
|
// Die with an error message if we can't write the entire buffer.
|
||||||
void xwrite(int fd, void *buf, size_t count)
|
void xwrite(int fd, void *buf, size_t count)
|
||||||
{
|
{
|
||||||
while (count) {
|
while (count) {
|
||||||
@ -160,7 +158,7 @@ void xwrite(int fd, void *buf, size_t count)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xlseek
|
#ifdef L_xlseek
|
||||||
/* Die with an error message if we can't lseek to the right spot. */
|
// Die with an error message if we can't lseek to the right spot.
|
||||||
void xlseek(int fd, off_t offset, int whence)
|
void xlseek(int fd, off_t offset, int whence)
|
||||||
{
|
{
|
||||||
if (offset != lseek(fd, offset, whence)) bb_error_msg_and_die("lseek");
|
if (offset != lseek(fd, offset, whence)) bb_error_msg_and_die("lseek");
|
||||||
@ -168,7 +166,7 @@ void xlseek(int fd, off_t offset, int whence)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xread_char
|
#ifdef L_xread_char
|
||||||
/* Die with an error message if we can't read one character. */
|
// Die with an error message if we can't read one character.
|
||||||
unsigned char xread_char(int fd)
|
unsigned char xread_char(int fd)
|
||||||
{
|
{
|
||||||
char tmp;
|
char tmp;
|
||||||
@ -180,7 +178,7 @@ unsigned char xread_char(int fd)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xferror
|
#ifdef L_xferror
|
||||||
/* Die with supplied error message if this FILE * has ferror set. */
|
// Die with supplied error message if this FILE * has ferror set.
|
||||||
void xferror(FILE *fp, const char *fn)
|
void xferror(FILE *fp, const char *fn)
|
||||||
{
|
{
|
||||||
if (ferror(fp)) {
|
if (ferror(fp)) {
|
||||||
@ -190,7 +188,7 @@ void xferror(FILE *fp, const char *fn)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xferror_stdout
|
#ifdef L_xferror_stdout
|
||||||
/* Die with an error message if stdout has ferror set. */
|
// Die with an error message if stdout has ferror set.
|
||||||
void xferror_stdout(void)
|
void xferror_stdout(void)
|
||||||
{
|
{
|
||||||
xferror(stdout, bb_msg_standard_output);
|
xferror(stdout, bb_msg_standard_output);
|
||||||
@ -198,7 +196,7 @@ void xferror_stdout(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xfflush_stdout
|
#ifdef L_xfflush_stdout
|
||||||
/* Die with an error message if we have trouble flushing stdout. */
|
// Die with an error message if we have trouble flushing stdout.
|
||||||
void xfflush_stdout(void)
|
void xfflush_stdout(void)
|
||||||
{
|
{
|
||||||
if (fflush(stdout)) {
|
if (fflush(stdout)) {
|
||||||
@ -208,25 +206,24 @@ void xfflush_stdout(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_spawn
|
#ifdef L_spawn
|
||||||
/* This does a fork/exec in one call, using vfork(). Return PID of new child,
|
// This does a fork/exec in one call, using vfork(). Return PID of new child,
|
||||||
* -1 for failure. Runs argv[0], searching path if that has no / in it.
|
// -1 for failure. Runs argv[0], searching path if that has no / in it.
|
||||||
*/
|
|
||||||
pid_t spawn(char **argv)
|
pid_t spawn(char **argv)
|
||||||
{
|
{
|
||||||
static int failed;
|
static int failed;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
void *app = ENABLE_FEATURE_SH_STANDALONE_SHELL ? find_applet_by_name(argv[0]) : 0;
|
void *app = ENABLE_FEATURE_SH_STANDALONE_SHELL ? find_applet_by_name(argv[0]) : 0;
|
||||||
|
|
||||||
/* Be nice to nommu machines. */
|
// Be nice to nommu machines.
|
||||||
failed = 0;
|
failed = 0;
|
||||||
pid = vfork();
|
pid = vfork();
|
||||||
if (pid < 0) return pid;
|
if (pid < 0) return pid;
|
||||||
if (!pid) {
|
if (!pid) {
|
||||||
execvp(app ? CONFIG_BUSYBOX_EXEC_PATH : *argv, argv);
|
execvp(app ? CONFIG_BUSYBOX_EXEC_PATH : *argv, argv);
|
||||||
|
|
||||||
/* We're sharing a stack with blocked parent, let parent know we failed
|
// We're sharing a stack with blocked parent, let parent know we failed
|
||||||
* and then exit to unblock parent (but don't run atexit() stuff, which
|
// and then exit to unblock parent (but don't run atexit() stuff, which
|
||||||
would screw up parent.) */
|
// would screw up parent.)
|
||||||
|
|
||||||
failed = -1;
|
failed = -1;
|
||||||
_exit(0);
|
_exit(0);
|
||||||
@ -236,7 +233,7 @@ pid_t spawn(char **argv)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xspawn
|
#ifdef L_xspawn
|
||||||
/* Die with an error message if we can't spawn a child process. */
|
// Die with an error message if we can't spawn a child process.
|
||||||
pid_t xspawn(char **argv)
|
pid_t xspawn(char **argv)
|
||||||
{
|
{
|
||||||
pid_t pid = spawn(argv);
|
pid_t pid = spawn(argv);
|
||||||
@ -246,7 +243,7 @@ pid_t xspawn(char **argv)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_wait4
|
#ifdef L_wait4
|
||||||
/* Wait for the specified child PID to exit, returning child's error return. */
|
// Wait for the specified child PID to exit, returning child's error return.
|
||||||
int wait4pid(int pid)
|
int wait4pid(int pid)
|
||||||
{
|
{
|
||||||
int status;
|
int status;
|
||||||
@ -259,9 +256,9 @@ int wait4pid(int pid)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_itoa
|
#ifdef L_itoa
|
||||||
/* Convert unsigned integer to ascii, writing into supplied buffer. A
|
// Convert unsigned integer to ascii, writing into supplied buffer. A
|
||||||
* truncated result is always null terminated (unless buflen is 0), and
|
// truncated result is always null terminated (unless buflen is 0), and
|
||||||
* contains the first few digits of the result ala strncpy. */
|
// contains the first few digits of the result ala strncpy.
|
||||||
void utoa_to_buf(unsigned n, char *buf, unsigned buflen)
|
void utoa_to_buf(unsigned n, char *buf, unsigned buflen)
|
||||||
{
|
{
|
||||||
int i, out = 0;
|
int i, out = 0;
|
||||||
@ -279,7 +276,7 @@ void utoa_to_buf(unsigned n, char *buf, unsigned buflen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert signed integer to ascii, like utoa_to_buf() */
|
// Convert signed integer to ascii, like utoa_to_buf()
|
||||||
void itoa_to_buf(int n, char *buf, unsigned buflen)
|
void itoa_to_buf(int n, char *buf, unsigned buflen)
|
||||||
{
|
{
|
||||||
if (buflen && n<0) {
|
if (buflen && n<0) {
|
||||||
@ -290,16 +287,16 @@ void itoa_to_buf(int n, char *buf, unsigned buflen)
|
|||||||
utoa_to_buf((unsigned)n, buf, buflen);
|
utoa_to_buf((unsigned)n, buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The following two functions use a static buffer, so calling either one a
|
// The following two functions use a static buffer, so calling either one a
|
||||||
* second time will overwrite previous results.
|
// second time will overwrite previous results.
|
||||||
*
|
//
|
||||||
* The largest 32 bit integer is -2 billion plus null terminator, or 12 bytes.
|
// The largest 32 bit integer is -2 billion plus null terminator, or 12 bytes.
|
||||||
* Int should always be 32 bits on any remotely Unix-like system, see
|
// Int should always be 32 bits on any remotely Unix-like system, see
|
||||||
* http://www.unix.org/whitepapers/64bit.html for the reasons why.
|
// http://www.unix.org/whitepapers/64bit.html for the reasons why.
|
||||||
*/
|
|
||||||
static char local_buf[12];
|
static char local_buf[12];
|
||||||
|
|
||||||
/* Convert unsigned integer to ascii using a static buffer (returned). */
|
// Convert unsigned integer to ascii using a static buffer (returned).
|
||||||
char *utoa(unsigned n)
|
char *utoa(unsigned n)
|
||||||
{
|
{
|
||||||
utoa_to_buf(n, local_buf, sizeof(local_buf));
|
utoa_to_buf(n, local_buf, sizeof(local_buf));
|
||||||
@ -307,7 +304,7 @@ char *utoa(unsigned n)
|
|||||||
return local_buf;
|
return local_buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Convert signed integer to ascii using a static buffer (returned). */
|
// Convert signed integer to ascii using a static buffer (returned).
|
||||||
char *itoa(int n)
|
char *itoa(int n)
|
||||||
{
|
{
|
||||||
itoa_to_buf(n, local_buf, sizeof(local_buf));
|
itoa_to_buf(n, local_buf, sizeof(local_buf));
|
||||||
@ -317,15 +314,15 @@ char *itoa(int n)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_setuid
|
#ifdef L_setuid
|
||||||
/* Die with an error message if we can't set gid. (Because resource limits may
|
// Die with an error message if we can't set gid. (Because resource limits may
|
||||||
* limit this user to a given number of processes, and if that fills up the
|
// limit this user to a given number of processes, and if that fills up the
|
||||||
* setgid() will fail and we'll _still_be_root_, which is bad.) */
|
// setgid() will fail and we'll _still_be_root_, which is bad.)
|
||||||
void xsetgid(gid_t gid)
|
void xsetgid(gid_t gid)
|
||||||
{
|
{
|
||||||
if (setgid(gid)) bb_error_msg_and_die("setgid");
|
if (setgid(gid)) bb_error_msg_and_die("setgid");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Die with an error message if we cant' set uid. (See xsetgid() for why.) */
|
// Die with an error message if we cant' set uid. (See xsetgid() for why.)
|
||||||
void xsetuid(uid_t uid)
|
void xsetuid(uid_t uid)
|
||||||
{
|
{
|
||||||
if (setuid(uid)) bb_error_msg_and_die("setuid");
|
if (setuid(uid)) bb_error_msg_and_die("setuid");
|
||||||
@ -333,31 +330,31 @@ void xsetuid(uid_t uid)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_fdlength
|
#ifdef L_fdlength
|
||||||
/* Return how long the file at fd is, if there's any way to determine it. */
|
// Return how long the file at fd is, if there's any way to determine it.
|
||||||
off_t fdlength(int fd)
|
off_t fdlength(int fd)
|
||||||
{
|
{
|
||||||
off_t bottom = 0, top = 0, pos;
|
off_t bottom = 0, top = 0, pos;
|
||||||
long size;
|
long size;
|
||||||
|
|
||||||
/* If the ioctl works for this, return it. */
|
// If the ioctl works for this, return it.
|
||||||
|
|
||||||
if (ioctl(fd, BLKGETSIZE, &size) >= 0) return size*512;
|
if (ioctl(fd, BLKGETSIZE, &size) >= 0) return size*512;
|
||||||
|
|
||||||
/* If not, do a binary search for the last location we can read. (Some
|
// If not, do a binary search for the last location we can read. (Some
|
||||||
* block devices don't do BLKGETSIZE right.) */
|
// block devices don't do BLKGETSIZE right.)
|
||||||
|
|
||||||
do {
|
do {
|
||||||
char temp;
|
char temp;
|
||||||
|
|
||||||
pos = bottom + (top - bottom) / 2;
|
pos = bottom + (top - bottom) / 2;
|
||||||
|
|
||||||
/* If we can read from the current location, it's bigger. */
|
// If we can read from the current location, it's bigger.
|
||||||
|
|
||||||
if (lseek(fd, pos, 0)>=0 && safe_read(fd, &temp, 1)==1) {
|
if (lseek(fd, pos, 0)>=0 && safe_read(fd, &temp, 1)==1) {
|
||||||
if (bottom == top) bottom = top = (top+1) * 2;
|
if (bottom == top) bottom = top = (top+1) * 2;
|
||||||
else bottom = pos;
|
else bottom = pos;
|
||||||
|
|
||||||
/* If we can't, it's smaller. */
|
// If we can't, it's smaller.
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (bottom == top) {
|
if (bottom == top) {
|
||||||
@ -373,8 +370,8 @@ off_t fdlength(int fd)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xasprintf
|
#ifdef L_xasprintf
|
||||||
/* Die with an error message if we can't malloc() enough space and do an
|
// Die with an error message if we can't malloc() enough space and do an
|
||||||
* sprintf() into that space. */
|
// sprintf() into that space.
|
||||||
char *xasprintf(const char *format, ...)
|
char *xasprintf(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list p;
|
va_list p;
|
||||||
@ -403,8 +400,8 @@ char *xasprintf(const char *format, ...)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xprint_and_close_file
|
#ifdef L_xprint_and_close_file
|
||||||
/* Die with an error message if we can't copy an entire FILE * to stdout, then
|
// Die with an error message if we can't copy an entire FILE * to stdout, then
|
||||||
* close that file. */
|
// close that file.
|
||||||
void xprint_and_close_file(FILE *file)
|
void xprint_and_close_file(FILE *file)
|
||||||
{
|
{
|
||||||
// copyfd outputs error messages for us.
|
// copyfd outputs error messages for us.
|
||||||
@ -416,7 +413,7 @@ void xprint_and_close_file(FILE *file)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xchdir
|
#ifdef L_xchdir
|
||||||
/* Die if we can't chdir to a new path. */
|
// Die if we can't chdir to a new path.
|
||||||
void xchdir(const char *path)
|
void xchdir(const char *path)
|
||||||
{
|
{
|
||||||
if (chdir(path))
|
if (chdir(path))
|
||||||
@ -425,7 +422,7 @@ void xchdir(const char *path)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_warn_opendir
|
#ifdef L_warn_opendir
|
||||||
/* Print a warning message if opendir() fails, but don't die. */
|
// Print a warning message if opendir() fails, but don't die.
|
||||||
DIR *warn_opendir(const char *path)
|
DIR *warn_opendir(const char *path)
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
@ -439,7 +436,7 @@ DIR *warn_opendir(const char *path)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xopendir
|
#ifdef L_xopendir
|
||||||
/* Die with an error message if opendir() fails. */
|
// Die with an error message if opendir() fails.
|
||||||
DIR *xopendir(const char *path)
|
DIR *xopendir(const char *path)
|
||||||
{
|
{
|
||||||
DIR *dp;
|
DIR *dp;
|
||||||
@ -452,7 +449,7 @@ DIR *xopendir(const char *path)
|
|||||||
|
|
||||||
#ifdef L_xdaemon
|
#ifdef L_xdaemon
|
||||||
#ifndef BB_NOMMU
|
#ifndef BB_NOMMU
|
||||||
/* Die with an error message if we can't daemonize. */
|
// Die with an error message if we can't daemonize.
|
||||||
void xdaemon(int nochdir, int noclose)
|
void xdaemon(int nochdir, int noclose)
|
||||||
{
|
{
|
||||||
if (daemon(nochdir, noclose)) bb_perror_msg_and_die("daemon");
|
if (daemon(nochdir, noclose)) bb_perror_msg_and_die("daemon");
|
||||||
@ -461,7 +458,7 @@ void xdaemon(int nochdir, int noclose)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xsocket
|
#ifdef L_xsocket
|
||||||
/* Die with an error message if we can't open a new socket. */
|
// Die with an error message if we can't open a new socket.
|
||||||
int xsocket(int domain, int type, int protocol)
|
int xsocket(int domain, int type, int protocol)
|
||||||
{
|
{
|
||||||
int r = socket(domain, type, protocol);
|
int r = socket(domain, type, protocol);
|
||||||
@ -473,7 +470,7 @@ int xsocket(int domain, int type, int protocol)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xbind
|
#ifdef L_xbind
|
||||||
/* Die with an error message if we can't bind a socket to an address. */
|
// Die with an error message if we can't bind a socket to an address.
|
||||||
void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen)
|
void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen)
|
||||||
{
|
{
|
||||||
if (bind(sockfd, my_addr, addrlen)) bb_perror_msg_and_die("bind");
|
if (bind(sockfd, my_addr, addrlen)) bb_perror_msg_and_die("bind");
|
||||||
@ -481,7 +478,7 @@ void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xlisten
|
#ifdef L_xlisten
|
||||||
/* Die with an error message if we can't listen for connections on a socket. */
|
// Die with an error message if we can't listen for connections on a socket.
|
||||||
void xlisten(int s, int backlog)
|
void xlisten(int s, int backlog)
|
||||||
{
|
{
|
||||||
if (listen(s, backlog)) bb_perror_msg_and_die("listen");
|
if (listen(s, backlog)) bb_perror_msg_and_die("listen");
|
||||||
@ -489,7 +486,7 @@ void xlisten(int s, int backlog)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef L_xstat
|
#ifdef L_xstat
|
||||||
/* xstat() - a stat() which dies on failure with meaningful error message */
|
// xstat() - a stat() which dies on failure with meaningful error message
|
||||||
void xstat(char *name, struct stat *stat_buf)
|
void xstat(char *name, struct stat *stat_buf)
|
||||||
{
|
{
|
||||||
if (stat(name, stat_buf))
|
if (stat(name, stat_buf))
|
||||||
|
Loading…
Reference in New Issue
Block a user