[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113441: A few more minor file errno-reporting bugs.
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r113441: A few more minor file errno-reporting bugs. |
Date: |
Wed, 17 Jul 2013 04:37:32 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113441
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2013-07-16 21:37:27 -0700
message:
A few more minor file errno-reporting bugs.
* callproc.c (Fcall_process):
* doc.c (Fsnarf_documentation):
* fileio.c (Frename_file, Fadd_name_to_file, Fmake_symbolic_link):
* process.c (set_socket_option):
Don't let a constructor trash errno.
* doc.c: Include <errno.h>.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/callproc.c callproc.c-20091113204419-o5vbwnq5f7feedwu-248
src/doc.c doc.c-20091113204419-o5vbwnq5f7feedwu-250
src/fileio.c fileio.c-20091113204419-o5vbwnq5f7feedwu-210
src/process.c process.c-20091113204419-o5vbwnq5f7feedwu-462
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-07-16 23:29:05 +0000
+++ b/src/ChangeLog 2013-07-17 04:37:27 +0000
@@ -1,3 +1,13 @@
+2013-07-17 Paul Eggert <address@hidden>
+
+ A few more minor file errno-reporting bugs.
+ * callproc.c (Fcall_process):
+ * doc.c (Fsnarf_documentation):
+ * fileio.c (Frename_file, Fadd_name_to_file, Fmake_symbolic_link):
+ * process.c (set_socket_option):
+ Don't let a constructor trash errno.
+ * doc.c: Include <errno.h>.
+
2013-07-16 Juanma Barranquero <address@hidden>
* w32fns.c (unwind_create_tip_frame): Fix declaration.
=== modified file 'src/callproc.c'
--- a/src/callproc.c 2013-07-16 22:40:17 +0000
+++ b/src/callproc.c 2013-07-17 04:37:27 +0000
@@ -405,7 +405,11 @@
filefd = emacs_open (SSDATA (infile), O_RDONLY, 0);
if (filefd < 0)
- report_file_error ("Opening process input file", DECODE_FILE (infile));
+ {
+ int open_errno = errno;
+ report_file_errno ("Opening process input file", DECODE_FILE (infile),
+ open_errno);
+ }
if (STRINGP (output_file))
{
=== modified file 'src/doc.c'
--- a/src/doc.c 2013-07-16 16:39:42 +0000
+++ b/src/doc.c 2013-07-17 04:37:27 +0000
@@ -21,6 +21,7 @@
#include <config.h>
+#include <errno.h>
#include <sys/types.h>
#include <sys/file.h> /* Must be after sys/types.h for USG. */
#include <fcntl.h>
@@ -609,7 +610,11 @@
fd = emacs_open (name, O_RDONLY, 0);
if (fd < 0)
- report_file_error ("Opening doc string file", build_string (name));
+ {
+ int open_errno = errno;
+ report_file_errno ("Opening doc string file", build_string (name),
+ open_errno);
+ }
Vdoc_file_name = filename;
filled = 0;
pos = 0;
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2013-07-16 21:49:32 +0000
+++ b/src/fileio.c 2013-07-17 04:37:27 +0000
@@ -204,7 +204,9 @@
}
/* Signal a file-access failure that set errno. STRING describes the
- failure, NAME the file involved. */
+ failure, NAME the file involved. When invoking this function, take
+ care to not use arguments such as build_string ("foo") that involve
+ side effects that may set errno. */
void
report_file_error (char const *string, Lisp_Object name)
@@ -2371,7 +2373,8 @@
INTEGERP (ok_if_already_exists), 0, 0);
if (rename (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0)
{
- if (errno == EXDEV)
+ int rename_errno = errno;
+ if (rename_errno == EXDEV)
{
ptrdiff_t count;
symlink_target = Ffile_symlink_p (file);
@@ -2397,7 +2400,7 @@
unbind_to (count, Qnil);
}
else
- report_file_error ("Renaming", list2 (file, newname));
+ report_file_errno ("Renaming", list2 (file, newname), rename_errno);
}
UNGCPRO;
return Qnil;
@@ -2451,7 +2454,10 @@
unlink (SSDATA (newname));
if (link (SSDATA (encoded_file), SSDATA (encoded_newname)) < 0)
- report_file_error ("Adding new name", list2 (file, newname));
+ {
+ int link_errno = errno;
+ report_file_errno ("Adding new name", list2 (file, newname), link_errno);
+ }
UNGCPRO;
return Qnil;
@@ -2510,6 +2516,7 @@
if (symlink (SSDATA (encoded_filename), SSDATA (encoded_linkname)) < 0)
{
/* If we didn't complain already, silently delete existing file. */
+ int symlink_errno;
if (errno == EEXIST)
{
unlink (SSDATA (encoded_linkname));
@@ -2527,7 +2534,9 @@
build_string ("Symbolic links are not supported"));
}
- report_file_error ("Making symbolic link", list2 (filename, linkname));
+ symlink_errno = errno;
+ report_file_errno ("Making symbolic link", list2 (filename, linkname),
+ symlink_errno);
}
UNGCPRO;
return Qnil;
=== modified file 'src/process.c'
--- a/src/process.c 2013-07-16 21:35:45 +0000
+++ b/src/process.c 2013-07-17 04:37:27 +0000
@@ -2321,7 +2321,12 @@
}
if (ret < 0)
- report_file_error ("Cannot set network option", list2 (opt, val));
+ {
+ int setsockopt_errno = errno;
+ report_file_errno ("Cannot set network option", list2 (opt, val),
+ setsockopt_errno);
+ }
+
return (1 << sopt->optbit);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113441: A few more minor file errno-reporting bugs.,
Paul Eggert <=