aboutsummaryrefslogtreecommitdiff
path: root/utility.c
diff options
context:
space:
mode:
authorerik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-01-26 20:06:48 +0000
committererik <erik@69ca8d6d-28ef-0310-b511-8ec308f3f277>2000-01-26 20:06:48 +0000
commitfa753f920b64a3f2c50295356e577a7c980c8408 (patch)
tree77236e83cc0583411a75b752a6152d445eb680e0 /utility.c
parent67c5194a104e193ec26bad4013c2a9aa9d73312f (diff)
downloadbusybox-w32-fa753f920b64a3f2c50295356e577a7c980c8408.tar.gz
busybox-w32-fa753f920b64a3f2c50295356e577a7c980c8408.tar.bz2
busybox-w32-fa753f920b64a3f2c50295356e577a7c980c8408.zip
mount and umount could leak loop device allocations causing the system to
quickly run out. Also disable init's SIGHUP handler during shutdown. -Erik git-svn-id: svn://busybox.net/trunk/busybox@341 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-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 @@
36#include <unistd.h> 36#include <unistd.h>
37#include <ctype.h> 37#include <ctype.h>
38 38
39#if defined BB_FEATURE_MOUNT_LOOP
40#include <fcntl.h>
41#include <sys/ioctl.h>
42#include <linux/loop.h>
43#endif
44
45
39#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF 46#if defined BB_MOUNT || defined BB_UMOUNT || defined BB_DF
40# if defined BB_FEATURE_USE_PROCFS 47# if defined BB_FEATURE_USE_PROCFS
41const char mtab_file[] = "/proc/mounts"; 48const char mtab_file[] = "/proc/mounts";
@@ -1146,4 +1153,22 @@ extern int vdprintf(int d, const char *format, va_list ap)
1146} 1153}
1147#endif 1154#endif
1148 1155
1156#if defined BB_FEATURE_MOUNT_LOOP
1157extern int del_loop(const char *device)
1158{
1159 int fd;
1160
1161 if ((fd = open(device, O_RDONLY)) < 0) {
1162 perror(device);
1163 return( FALSE);
1164 }
1165 if (ioctl(fd, LOOP_CLR_FD, 0) < 0) {
1166 perror("ioctl: LOOP_CLR_FD");
1167 return( FALSE);
1168 }
1169 close(fd);
1170 return( TRUE);
1171}
1172#endif
1173
1149/* END CODE */ 1174/* END CODE */