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

[MiNT] cstrip open fix



Hello.

I'm going to upgrade my mintbin package, and I remember I use a small patch for it since the beginning.

It is about the open() system call. The Linux doc says that the mode flags must be specified when O_CREAT is used, and they are missing at some place in cstrip. I had trouble with that on some system (Cygwin ?) in early days. I have just reworked my original patch to use creat() instead, as expected.

Please someone commit!

Replaced wrong open() usage by creat(). Contributed by Vincent Riviere.

--
Vincent Rivière
diff -aurN mintbin-CVS-20110521.orig/src/cstrip.c mintbin-CVS-20110521/src/cstrip.c
--- mintbin-CVS-20110521.orig/src/cstrip.c	2011-05-21 16:06:27.000000000 +0200
+++ mintbin-CVS-20110521/src/cstrip.c	2011-05-21 16:43:33.078125000 +0200
@@ -510,7 +510,7 @@
   otarget = xmalloc (sizeof *otarget);
   (void) memset (otarget, 0, sizeof *otarget);
   otarget->filename = output_filename;
-  otarget->desc = open (output_filename, O_WRONLY | O_CREAT);
+  otarget->desc = creat (output_filename, S_IRWXU | S_IRWXG | S_IRWXO);
   if (otarget->desc < 0)
     {
       status = EXIT_FAILURE;