aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Andersen <andersen@codepoet.org>2000-03-22 00:58:54 +0000
committerErik Andersen <andersen@codepoet.org>2000-03-22 00:58:54 +0000
commit016ffe93077975b01e84493d7cc303f78f70441a (patch)
treebeb56b390dfd7db3fb0239ba40e44d6bb5ad4fa7
parent0d068a20676144e9fd6796cc77764c420d785394 (diff)
downloadbusybox-w32-016ffe93077975b01e84493d7cc303f78f70441a.tar.gz
busybox-w32-016ffe93077975b01e84493d7cc303f78f70441a.tar.bz2
busybox-w32-016ffe93077975b01e84493d7cc303f78f70441a.zip
Add in a nifty function for mount to use.
-Erik
-rw-r--r--utility.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/utility.c b/utility.c
index 29edbf1c4..37f698ea4 100644
--- a/utility.c
+++ b/utility.c
@@ -1469,6 +1469,42 @@ extern char *find_unused_loop_device(void)
1469} 1469}
1470#endif /* BB_FEATURE_MOUNT_LOOP */ 1470#endif /* BB_FEATURE_MOUNT_LOOP */
1471 1471
1472#if defined BB_MOUNT
1473char* find_real_root_device_name(void)
1474{
1475 int gotIt=0;
1476 DIR *dir;
1477 struct dirent *entry;
1478 struct stat statBuf, rootStat;
1479 char fileName[BUFSIZ];
1480
1481 if (stat("/", &rootStat) != 0)
1482 fatalError("Wierd. I could not stat '/'\n");
1483
1484 if (!(dir = opendir("/dev"));
1485 fatalError("Wierd. I could not open '/dev'\n");
1486
1487 while((entry = readdir(dir)) != NULL) {
1488 /* Must skip ".." since that is "/", and so we
1489 * would get a false positive on ".." */
1490
1491 if (strcmp(entry->d_name, "..") == 0)
1492 continue;
1493
1494 sprintf( fileName, "/dev/%s", entry->d_name);
1495
1496 if (stat(fileName, &statBuf) != 0)
1497 continue;
1498 if (statBuf.st_rdev == rootStat.st_rdev) {
1499 return (strdup(fileName));
1500 }
1501 }
1502
1503 return( NULL);
1504}
1505#endif
1506
1507
1472#if defined BB_MTAB 1508#if defined BB_MTAB
1473#define whine_if_fstab_is_missing() {} 1509#define whine_if_fstab_is_missing() {}
1474#else 1510#else