info-mtools
[Top][All Lists]
Advanced

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

[mtools] Two things about file open mode


From: Eugene Kotlyarov
Subject: [mtools] Two things about file open mode
Date: Tue, 04 May 2004 11:04:40 +0400
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7b) Gecko/20040421 MultiZilla/1.5.0.4d

Hello

1. filemode for -C option of mformat should probably include O_TRUNC option or it can create images with wrong size 2. Maybe it would be better to explicitly open image files in binary mode. Now it causes problems in certain configuration on Cygwin
--- mformat.orig.c      2004-05-04 10:15:55.140625000 +0400
+++ mformat.c   2004-05-04 10:16:20.250000000 +0400
@@ -874,7 +874,7 @@
                                break;
 
                        case 'C':
-                               create = O_CREAT;
+                               create = O_CREAT | O_TRUNC;
                                break;
 
                        case 'H':
--- plain_io.orig.c     2004-05-04 10:17:17.906250000 +0400
+++ plain_io.c  2004-05-04 10:17:35.656250000 +0400
@@ -599,7 +599,7 @@
                    This->fd = scsi_open(name, mode, IS_NOLOCK(dev)?0444:0666,
                                         &This->extra_data);
                else
-                   This->fd = open(name, mode | O_LARGEFILE, 
+                   This->fd = open(name, mode | O_LARGEFILE | O_BINARY, 
                                    IS_NOLOCK(dev)?0444:0666);
            }
 

reply via email to

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