aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-01-26 20:06:48 +0000
committerErik Andersen <andersen@codepoet.org>2000-01-26 20:06:48 +0000
commit5cbdd712f5320ffc109053a94b7cf36c82292cf6 (patch)
tree77236e83cc0583411a75b752a6152d445eb680e0 /utility.c
parent3fe39dce5d1a0b0946878c66bbd7f694c5aa38ea (diff)
downloadbusybox-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.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index 8139f38d9..643c3b5f2 100644
--- a/utility.c
+++ b/utility.c
@@ -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 */