tag 301038 patch
thanks

It appears that the imagefs crash can be avoided by pre-creating the
file.  It will crash if the file doesn't exist, but seems to succeed
if you /usr/bin/touch the file beforehand.

There's something wrong with the constructor CImage::CImage.  When you
try to create a file, its boolean create parameters is true; but the
code is wrong somehow, and strace has:

  open("z", O_RDWR)                       = -1 ENOENT (No such file or 
directory)

instead of creat("z").  So, someone that actually knows something
about c++ needs to look at the code an either create the file
beforehand, or add a flag similar to O_CREAT.

There are other problems, too, but they seem to be caused only by lack
of input checking:

$ imagefs d a
Read directory from image file [a].
Fatal: could not open file a.
Directory listing: 
Segmentation fault (core dumped)

$ imagefs r a c
Remove files from image file [a].
Fatal: could not open file a.
Segmentation fault (core dumped)

That's pretty simple to solve:
    catch (...)
    {
      cout << "Fatal: could not open file " << pcImageFile << "." << endl;
+     return 1;
    }

There are several instances of these.  Probably there should be a
wrapper function which outputs "Fatal: %s" to stderr, and exit(1) (or
whatever the c++ification of exit is).

Justin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to