From a85e83d0dbf5e7396452dff5629ffa718fea3a5b Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 16 Jul 2010 21:55:56 +0200 Subject: [PATCH] use mkostemp(template, 0) instead of mkstemp to work around Cygwin oddity 2010-07-16 Paolo Bonzini * autoboot.conf (gnulib_modules): Replace mkstemp with mkostemp. * bootstrap.sh.in: Compile mkostemp.c instead of mkstemp.c. * gnulib: Update. * NEWS: Mention change. * sed/utils.c (ck_mkstemp): Use mkostemp to work around Cygwin oddity. Reported by Stepan Kasal. --- ChangeLog | 9 +++++++++ NEWS | 2 ++ autoboot.conf | 2 +- bootstrap.sh.in | 2 +- build-aux/.gitignore | 4 ++++ gnulib | 2 +- lib/.gitignore | 20 +++++++++++++++++++- m4/.gitignore | 16 ++++++++++++++++ sed/utils.c | 6 ++++-- 9 files changed, 57 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4e69c6f..e107fb0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2010-07-16 Paolo Bonzini + + * autoboot.conf (gnulib_modules): Replace mkstemp with mkostemp. + * bootstrap.sh.in: Compile mkostemp.c instead of mkstemp.c. + * gnulib: Update. + * NEWS: Mention change. + * sed/utils.c (ck_mkstemp): Use mkostemp to work around Cygwin + oddity. Reported by Stepan Kasal. + 2010-05-03 Timothy Baker (tiny change) * doc/sed.texi (Regular expressions): Fix typo. diff --git a/NEWS b/NEWS index 085e758..017fb70 100644 --- a/NEWS +++ b/NEWS @@ -6,6 +6,8 @@ Sed 4.2.2 * New command `F' to print current input file name +* -i does not convert the input file to binary (LF-terminated) on Cygwin + ---------------------------------------------------------------------------- Sed 4.2.1 diff --git a/autoboot.conf b/autoboot.conf index 68e7feb..8445276 100644 --- a/autoboot.conf +++ b/autoboot.conf @@ -19,7 +19,7 @@ # gnulib modules used by this package. gnulib_modules=" acl alloca btowc c-ctype extensions getline getopt gettext localcharset - mbrlen mbrtowc mbsinit memchr mkstemp obstack pathmax regex rename + mbrlen mbrtowc mbsinit memchr mkostemp obstack pathmax regex rename selinux-h stdbool stat-macros ssize_t strerror strverscmp unlocked-io verify wcrtomb wctob" diff --git a/bootstrap.sh.in b/bootstrap.sh.in index 9905b7a..4a3e929 100755 --- a/bootstrap.sh.in +++ b/bootstrap.sh.in @@ -123,7 +123,7 @@ ${CC} -DHAVE_CONFIG_H -I.. -I. -c getline.c || exit 1 ${CC} -DHAVE_CONFIG_H -I.. -I. -c getopt.c || exit 1 ${CC} -DHAVE_CONFIG_H -I.. -I. -c getopt1.c || exit 1 ${CC} -DHAVE_CONFIG_H -I.. -I. -c malloc.c || exit 1 -${CC} -DHAVE_CONFIG_H -I.. -I. -c mkstemp.c || exit 1 +${CC} -DHAVE_CONFIG_H -I.. -I. -c mkostemp.c || exit 1 ${CC} -DHAVE_CONFIG_H -I.. -I. -c obstack.c || exit 1 ${CC} -DHAVE_CONFIG_H -I.. -I. -c quote.c || exit 1 ${CC} -DHAVE_CONFIG_H -I.. -I. -c quotearg.c || exit 1 diff --git a/build-aux/.gitignore b/build-aux/.gitignore index 37fc209..718a580 100644 --- a/build-aux/.gitignore +++ b/build-aux/.gitignore @@ -1,4 +1,8 @@ +arg-nonnull.h +c++defs.h config.rpath install-sh link-warning.h texinfo.tex +unused-parameter.h +warn-on-use.h diff --git a/gnulib b/gnulib index b653eda..afc6cbe 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit b653eda3ac4864de205419d9f41eec267cb89eeb +Subproject commit afc6cbe4fe4892c5ee4166cab87fede6f294a27d diff --git a/lib/.gitignore b/lib/.gitignore index 17d4e23..89d3225 100644 --- a/lib/.gitignore +++ b/lib/.gitignore @@ -4,12 +4,15 @@ acl_entries.c alloca.c alloca.h alloca.in.h +basename-lgpl.c basename.c btowc.c c-ctype.c c-ctype.h +canonicalize-lgpl.c config.charset copy-acl.c +dirname-lgpl.c dirname.c dirname.h errno.h @@ -20,6 +23,7 @@ exitfail.c exitfail.h file-has-acl.c getdelim.c +getfilecon.c getline.c getopt.c getopt.h @@ -31,10 +35,15 @@ gettext.h gettimeofday.c gnulib.mk intprops.h +langinfo.h +langinfo.in.h localcharset.c localcharset.h lstat.c malloc.c +malloca.c +malloca.h +malloca.valgrind mbrlen.c mbrtowc.c mbsinit.c @@ -42,7 +51,8 @@ memchr.c memchr.valgrind memcmp.c memmove.c -mkstemp.c +mkostemp.c +nl_langinfo.c obstack.c obstack.h pathmax.h @@ -50,6 +60,7 @@ quote.c quote.h quotearg.c quotearg.h +readlink.c realloc.c ref-add.sed ref-add.sin @@ -62,14 +73,19 @@ regex_internal.c regex_internal.h regexec.c rename.c +rmdir.c +same-inode.h se-context.h se-context.in.h se-selinux.h se-selinux.in.h set-mode-acl.c stat-macros.h +stat.c stdbool.h stdbool.in.h +stddef.h +stddef.in.h stdint.h stdint.in.h stdio-write.c @@ -92,6 +108,8 @@ sys_time.h sys_time.in.h tempname.c tempname.h +time.h +time.in.h unistd.h unistd.in.h unlocked-io.h diff --git a/m4/.gitignore b/m4/.gitignore index 3ab333d..37a2390 100644 --- a/m4/.gitignore +++ b/m4/.gitignore @@ -2,15 +2,19 @@ 00gnulib.m4 acl.m4 alloca.m4 +asm-underscore.m4 btowc.m4 +canonicalize.m4 codeset.m4 dirname.m4 dos.m4 double-slash-root.m4 +eealloc.m4 errno_h.m4 error.m4 exitfail.m4 extensions.m4 +fcntl-o.m4 getdelim.m4 getline.m4 getopt.m4 @@ -34,6 +38,7 @@ intmax.m4 inttypes-h.m4 inttypes-pri.m4 inttypes_h.m4 +langinfo_h.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 @@ -47,6 +52,7 @@ longdouble.m4 longlong.m4 lstat.m4 malloc.m4 +malloca.m4 mbrlen.m4 mbrtowc.m4 mbsinit.m4 @@ -54,9 +60,11 @@ mbstate_t.m4 memchr.m4 memcmp.m4 memmove.m4 +mkostemp.m4 mkstemp.m4 mmap-anon.m4 multiarch.m4 +nl_langinfo.m4 nls.m4 pathmax.m4 po.m4 @@ -64,15 +72,19 @@ printf-posix.m4 progtest.m4 quote.m4 quotearg.m4 +readlink.m4 realloc.m4 regex.m4 rename.m4 +rmdir.m4 selinux-context-h.m4 selinux-selinux-h.m4 signed.m4 size_max.m4 ssize_t.m4 +stat.m4 stdbool.m4 +stddef_h.m4 stdint.m4 stdint_h.m4 stdio_h.m4 @@ -86,16 +98,20 @@ sys_stat_h.m4 sys_time_h.m4 tempname.m4 threadlib.m4 +time_h.m4 uintmax_t.m4 ulonglong.m4 unistd_h.m4 unlocked-io.m4 visibility.m4 +warn-on-use.m4 wchar.m4 +wchar_h.m4 wchar_t.m4 wcrtomb.m4 wctob.m4 wctype.m4 +wctype_h.m4 wint_t.m4 xalloc.m4 xsize.m4 diff --git a/sed/utils.c b/sed/utils.c index 241ef1d..226089a 100644 --- a/sed/utils.c +++ b/sed/utils.c @@ -211,9 +211,11 @@ ck_mkstemp (p_filename, tmpdir, base) sprintf (template, "%s/%sXXXXXX", tmpdir, base); /* The ownership might change, so omit some permissions at first - so unauthorized users cannot nip in before the file is ready. */ + so unauthorized users cannot nip in before the file is ready. + + mkstemp forces O_BINARY on cygwin, so use mkostemp instead. */ save_umask = umask (0700); - fd = mkstemp (template); + fd = mkostemp (template, 0); umask (save_umask); if (fd == -1) panic(_("couldn't open temporary file %s: %s"), template, strerror(errno));