summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2009-01-20 14:03:56 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2009-01-20 14:03:56 -0800
commitf53f2ac59ac8deb57e243143ed7c32ca8cc94bbd (patch)
treeb4d813b0d4c084f9a6af716ca95fc37b42d17f0b
parent7c483b4c9a27aaf23a4b2f5d5f1712b2a3cb0460 (diff)
downloaddosfstools-f53f2ac59ac8deb57e243143ed7c32ca8cc94bbd.tar.gz
auto import from //branches/cupcake/...@127101
-rw-r--r--Android.mk3
-rw-r--r--src/boot.c18
-rw-r--r--src/dosfsck.c2
3 files changed, 17 insertions, 6 deletions
diff --git a/Android.mk b/Android.mk
index 52986c7..3c3cb61 100644
--- a/Android.mk
+++ b/Android.mk
@@ -1,4 +1,3 @@
ifneq ($(TARGET_SIMULATOR),true)
-## Disabled for now - San
-## include $(call all-subdir-makefiles)
+ include $(call all-subdir-makefiles)
endif
diff --git a/src/boot.c b/src/boot.c
index 0243c69..432ccdb 100644
--- a/src/boot.c
+++ b/src/boot.c
@@ -27,6 +27,7 @@
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
+#include <stdarg.h>
#include "common.h"
#include "dosfsck.h"
@@ -69,6 +70,17 @@ static struct {
#define GET_UNALIGNED_W(f) CF_LE_W( *(unsigned short *)&f )
#endif
+void die_notfat(char *msg,...)
+{
+ va_list args;
+
+ va_start(args,msg);
+ vfprintf(stderr,msg,args);
+ va_end(args);
+ fprintf(stderr,"\n");
+ exit(4);
+}
+
static char *get_media_descr( unsigned char media )
{
@@ -299,9 +311,9 @@ void read_boot(DOS_FS *fs)
fs_read(0,sizeof(b),&b);
logical_sector_size = GET_UNALIGNED_W(b.sector_size);
- if (!logical_sector_size) die("Logical sector size is zero.");
+ if (!logical_sector_size) die_notfat("Logical sector size is zero.");
fs->cluster_size = b.cluster_size*logical_sector_size;
- if (!fs->cluster_size) die("Cluster size is zero.");
+ if (!fs->cluster_size) die_notfat("Cluster size is zero.");
if (b.fats != 2 && b.fats != 1)
die("Currently, only 1 or 2 FATs are supported, not %d.\n",b.fats);
fs->nfats = b.fats;
@@ -337,7 +349,7 @@ void read_boot(DOS_FS *fs)
printf( "Warning: FAT32 root dir not in cluster chain! "
"Compability mode...\n" );
else if (!fs->root_cluster && !fs->root_entries)
- die("No root directory!");
+ die_notfat("No root directory!");
else if (fs->root_cluster && fs->root_entries)
printf( "Warning: FAT32 root dir is in a cluster chain, but "
"a separate root dir\n"
diff --git a/src/dosfsck.c b/src/dosfsck.c
index 0a57030..7a5ba25 100644
--- a/src/dosfsck.c
+++ b/src/dosfsck.c
@@ -199,7 +199,7 @@ int main(int argc,char **argv)
printf( "%s: %u files, %lu/%lu clusters\n", argv[optind],
n_files, fs.clusters - free_clusters, fs.clusters );
- return fs_close(rw) ? 1 : 0;
+ exit(fs_close(rw) ? 4 : 0);
}
/* Local Variables: */