diff options
author | Erik Andersen | 2000-01-26 20:06:48 +0000 |
---|---|---|
committer | Erik Andersen | 2000-01-26 20:06:48 +0000 |
commit | 5cbdd712f5320ffc109053a94b7cf36c82292cf6 (patch) | |
tree | 77236e83cc0583411a75b752a6152d445eb680e0 /utility.c | |
parent | 3fe39dce5d1a0b0946878c66bbd7f694c5aa38ea (diff) | |
download | busybox-5cbdd712f5320ffc109053a94b7cf36c82292cf6.zip busybox-5cbdd712f5320ffc109053a94b7cf36c82292cf6.tar.gz |
mount and umount could leak loop device allocations causing the system to
quickly run out. Also disable init's SIGHUP handler during shutdown.
-Erik
Diffstat (limited to 'utility.c')
-rw-r--r-- | utility.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -36,6 +36,13 @@ #include <unistd.h> #include <ctype.h> +#if defined BB_FEATURE_MOUNT_LOOP +#include <fcntl.h> +#include <sys/ioctl.h> +#include <linux/loop.h> +#endif + + #if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF # if defined BB_FEATURE_USE_PROCFS const char mtab_file[] = "/proc/mounts"; @@ -1146,4 +1153,22 @@ extern int vdprintf(int d, const char *format, va_list ap) } #endif +#if defined BB_FEATURE_MOUNT_LOOP +extern int del_loop(const char *device) +{ + int fd; + + if ((fd = open(device, O_RDONLY)) < 0) { + perror(device); + return( FALSE); + } + if (ioctl(fd, LOOP_CLR_FD, 0) < 0) { + perror("ioctl: LOOP_CLR_FD"); + return( FALSE); + } + close(fd); + return( TRUE); +} +#endif + /* END CODE */ |