mount and umount could leak loop device allocations causing the system to

quickly run out.  Also disable init's SIGHUP handler during shutdown.
 -Erik
This commit is contained in:
Erik Andersen
2000-01-26 20:06:48 +00:00
parent 3fe39dce5d
commit 5cbdd712f5
11 changed files with 266 additions and 264 deletions

View File

@ -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 */