info-mtools
[Top][All Lists]
Advanced

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

[Info-mtools] for consideration: patch: do not bomb when images are on a


From: zeurkous
Subject: [Info-mtools] for consideration: patch: do not bomb when images are on an fs that does not support locking
Date: Fri, 30 Oct 2020 19:20:36 +0100

#?patch
#
# This patch makes mcopy(1) et al. not bomb when copying from images 
# that cannot be locked (for example: because they are on an ISO9660
# file system on OpenBSD).
#
# Written in me own style since me's decidely uncomfortable w/ the
# mtools(1) one, and me really needed the fix :)
#
# Take care,
#
#          --zeurkous, Fri Oct 30 17:40:39 UTC 2020.
#
--- ..ar/0/plain_io.c   Sun Dec  9 10:57:33 2018
+++ plain_io.c  Tue Oct 13 22:34:32 2020
@@ -21,8 +21,14 @@
  * Alain L. Knaff                      
  * alain@knaff.lu
  *
+ *
+ * zeurkous Tue Oct 13 22:33:39 UTC 2020: make lock EOPNOTSUPP non-fatal
  */
 
+#include <err.h>   /* for 'warn' */
+#include <errno.h> /* for 'EOPNOTSUPP',
+                          'errno'       */
+
 #include "sysincludes.h"
 #include "stream.h"
 #include "mtools.h"
@@ -624,7 +630,10 @@
 #ifndef __CYGWIN__
 #ifndef OS_mingw32msvc
        /* lock the device on writes */
-       if (locked && lock_dev(This->fd, mode == O_RDWR, dev)) {
+       if (locked && lock_dev(This->fd, mode == O_RDWR, dev)) 
+        {
+         if(errno == EOPNOTSUPP) warn("lock_dev"); else
+         {
                if(errmsg)
 #ifdef HAVE_SNPRINTF
                        snprintf(errmsg,199,
@@ -640,7 +649,7 @@
                close(This->fd);
                Free(This);
                return NULL;
-       }
+        }}
 #endif
 #endif
 #endif



reply via email to

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