[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[mtools] Bug in Mtools-3.9.10 for _unix_loop

From: Grant Erickson
Subject: [mtools] Bug in Mtools-3.9.10 for _unix_loop
Date: Thu, 29 Sep 2005 11:05:29 -0500 (CDT)

Greetings, I found a bug in mtools-3.9.10 this week that caused a makefile
which incorporated mcopy to silently fail. The general invocation was:

        rm -f C:/cygwin/home/gerickson/build/mtools.conf
        touch C:/cygwin/home/gerickson/build/mtools.conf
        printf "drive a:\n" >> C:/cygwin/home/gerickson/build/mtools.conf
        printf "\tfile=\"C:/cygwin/home/gerickson/build/root.dmg\"\n" >> 
        printf "\tmformat_only=1\n" >> 
        rm -f C:/cygwin/home/gerickson/build/root.dmg
C:/cygwin/home/gerickson/build/i686-pc-cygwin/mformat -C -v root -h 16 -s 32 -t 
16 a:
C:/cygwin/home/gerickson/build/i686-pc-cygwin/mcopy -v -m -s -Q 
/home/gerickson/build/root a:

The problem ended up being in _unix_loop(). It was set to always return
GET_ONE. So, even if unix_dir_loop() returned ERROR_ONE (possibly ORed in
with other status), the error would be ignored and 0 would always be
returned to the shell. This was disastrous since the disk image creation
failed but the build would silently continue in the face of it.

The following diff makes _unix_loop properly propagate status from
unix_dir_loop and makes mcopy/mtools return proper status to the parent
process (e.g. the shell) when there's an error:

--- mainloop.c.O        2005-09-29 08:57:28.613250000 -0700
+++ mainloop.c  2005-09-28 13:30:06.238250000 -0700
@@ -20,8 +20,7 @@

 static int _unix_loop(Stream_t *Dir, MainParam_t *mp, const char *filename)
-        unix_dir_loop(Dir, mp);
-        return GOT_ONE;
+        return unix_dir_loop(Dir, mp);

 int unix_loop(Stream_t *Stream, MainParam_t *mp, char *arg, int 


Grant Erickson
mtools mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]