[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] trunk r113435: Be simpler and more consistent about report
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] trunk r113435: Be simpler and more consistent about reporting I/O errors. |
Date: |
Tue, 16 Jul 2013 18:30:56 +0000 |
User-agent: |
Bazaar (2.6b2) |
------------------------------------------------------------
revno: 113435
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Tue 2013-07-16 11:30:52 -0700
message:
Be simpler and more consistent about reporting I/O errors.
* fileio.c (Fcopy_file, Finsert_file_contents, Fwrite_region):
Say "Read error" and "Write error", rather than "I/O error", or
"IO error reading", or "IO error writing", when a read or write
error occurs.
* process.c (Fmake_network_process, wait_reading_process_output)
(send_process, Fprocess_send_eof, wait_reading_process_output):
Capitalize diagnostics consistently. Put "failed foo" at the
start of the diagnostic, so that we don't capitalize the
function name "foo". Consistently say "failed" for such
diagnostics.
* sysdep.c, w32.c (serial_open): Now accepts Lisp string, not C string.
All callers changed. This is so it can use report_file_error.
* sysdep.c (serial_open, serial_configure): Capitalize I/O
diagnostics consistently as above.
modified:
src/ChangeLog changelog-20091113204419-o5vbwnq5f7feedwu-1438
src/fileio.c fileio.c-20091113204419-o5vbwnq5f7feedwu-210
src/process.c process.c-20091113204419-o5vbwnq5f7feedwu-462
src/sysdep.c sysdep.c-20091113204419-o5vbwnq5f7feedwu-448
src/systty.h systty.h-20091113204419-o5vbwnq5f7feedwu-463
src/w32.c w32.c-20091113204419-o5vbwnq5f7feedwu-808
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-07-16 16:39:42 +0000
+++ b/src/ChangeLog 2013-07-16 18:30:52 +0000
@@ -1,5 +1,21 @@
2013-07-16 Paul Eggert <address@hidden>
+ Be simpler and more consistent about reporting I/O errors.
+ * fileio.c (Fcopy_file, Finsert_file_contents, Fwrite_region):
+ Say "Read error" and "Write error", rather than "I/O error", or
+ "IO error reading", or "IO error writing", when a read or write
+ error occurs.
+ * process.c (Fmake_network_process, wait_reading_process_output)
+ (send_process, Fprocess_send_eof, wait_reading_process_output):
+ Capitalize diagnostics consistently. Put "failed foo" at the
+ start of the diagnostic, so that we don't capitalize the
+ function name "foo". Consistently say "failed" for such
+ diagnostics.
+ * sysdep.c, w32.c (serial_open): Now accepts Lisp string, not C string.
+ All callers changed. This is so it can use report_file_error.
+ * sysdep.c (serial_open, serial_configure): Capitalize I/O
+ diagnostics consistently as above.
+
* fileio.c (report_file_errno): Fix errno reporting bug.
If the file name is neither null nor a pair, package it up as a
singleton list. All callers changed, both to this function and to
=== modified file 'src/fileio.c'
--- a/src/fileio.c 2013-07-16 16:39:42 +0000
+++ b/src/fileio.c 2013-07-16 18:30:52 +0000
@@ -2125,7 +2125,7 @@
QUIT;
while ((n = emacs_read (ifd, buf, sizeof buf)) > 0)
if (emacs_write_sig (ofd, buf, n) != n)
- report_file_error ("I/O error", newname);
+ report_file_error ("Write error", newname);
immediate_quit = 0;
#ifndef MSDOS
@@ -2182,7 +2182,7 @@
}
if (emacs_close (ofd) < 0)
- report_file_error ("I/O error", newname);
+ report_file_error ("Write error", newname);
emacs_close (ifd);
@@ -3697,8 +3697,7 @@
}
if (nread < 0)
- error ("IO error reading %s: %s",
- SDATA (orig_filename), emacs_strerror (errno));
+ report_file_error ("Read error", orig_filename);
else if (nread > 0)
{
struct buffer *prev = current_buffer;
@@ -3813,8 +3812,7 @@
nread = emacs_read (fd, read_buf, sizeof read_buf);
if (nread < 0)
- error ("IO error reading %s: %s",
- SSDATA (orig_filename), emacs_strerror (errno));
+ report_file_error ("Read error", orig_filename);
else if (nread == 0)
break;
@@ -3879,8 +3877,7 @@
{
nread = emacs_read (fd, read_buf + total_read, trial -
total_read);
if (nread < 0)
- error ("IO error reading %s: %s",
- SDATA (orig_filename), emacs_strerror (errno));
+ report_file_error ("Read error", orig_filename);
else if (nread == 0)
break;
total_read += nread;
@@ -4030,8 +4027,7 @@
deferred_remove_unwind_protect = 1;
if (this < 0)
- error ("IO error reading %s: %s",
- SDATA (orig_filename), emacs_strerror (errno));
+ report_file_error ("Read error", orig_filename);
if (unprocessed > 0)
{
@@ -4277,8 +4273,7 @@
specpdl_ptr--;
if (how_much < 0)
- error ("IO error reading %s: %s",
- SDATA (orig_filename), emacs_strerror (errno));
+ report_file_error ("Read error", orig_filename);
/* Make the text read part of the buffer. */
GAP_SIZE -= inserted;
@@ -5071,8 +5066,7 @@
}
if (! ok)
- error ("IO error writing %s: %s", SDATA (filename),
- emacs_strerror (save_errno));
+ report_file_errno ("Write error", filename, save_errno);
if (visiting)
{
=== modified file 'src/process.c'
--- a/src/process.c 2013-07-16 16:39:42 +0000
+++ b/src/process.c 2013-07-16 18:30:52 +0000
@@ -2573,7 +2573,7 @@
record_unwind_protect (make_serial_process_unwind, proc);
p = XPROCESS (proc);
- fd = serial_open (SSDATA (port));
+ fd = serial_open (port);
p->infd = fd;
p->outfd = fd;
if (fd > max_process_desc)
@@ -3257,16 +3257,16 @@
if (errno == EINTR)
goto retry_select;
else
- report_file_error ("select failed", Qnil);
+ report_file_error ("Failed select", Qnil);
}
eassert (sc > 0);
len = sizeof xerrno;
eassert (FD_ISSET (s, &fdset));
if (getsockopt (s, SOL_SOCKET, SO_ERROR, &xerrno, &len) < 0)
- report_file_error ("getsockopt failed", Qnil);
+ report_file_error ("Failed getsockopt", Qnil);
if (xerrno)
- report_file_errno ("error during connect", Qnil, xerrno);
+ report_file_errno ("Failed connect", Qnil, xerrno);
break;
}
#endif /* !WINDOWSNT */
@@ -4624,7 +4624,7 @@
else if (xerrno == EBADF)
emacs_abort ();
else
- error ("select error: %s", emacs_strerror (xerrno));
+ report_file_errno ("Failed select", Qnil, xerrno);
}
if (no_avail)
@@ -5466,7 +5466,7 @@
if (rv >= 0)
written = rv;
else if (errno == EMSGSIZE)
- report_file_error ("sending datagram", proc);
+ report_file_error ("Sending datagram", proc);
}
else
#endif
@@ -5543,7 +5543,7 @@
}
else
/* This is a real error. */
- report_file_error ("writing to process", proc);
+ report_file_error ("Writing to process", proc);
}
cur_buf += written;
cur_len -= written;
@@ -6037,7 +6037,7 @@
{
#ifndef WINDOWSNT
if (tcdrain (XPROCESS (proc)->outfd) != 0)
- error ("tcdrain() failed: %s", emacs_strerror (errno));
+ report_file_error ("Failed tcdrain", Qnil);
#endif /* not WINDOWSNT */
/* Do nothing on Windows because writes are blocking. */
}
@@ -6733,7 +6733,7 @@
if (xerrno == EINTR)
FD_ZERO (&waitchannels);
else
- error ("select error: %s", emacs_strerror (xerrno));
+ report_file_errno ("Failed select", Qnil, xerrno);
}
/* Check for keyboard input */
=== modified file 'src/sysdep.c'
--- a/src/sysdep.c 2013-07-16 07:05:41 +0000
+++ b/src/sysdep.c 2013-07-16 18:30:52 +0000
@@ -2436,14 +2436,11 @@
#ifndef DOS_NT
/* For make-serial-process */
int
-serial_open (char *port)
+serial_open (Lisp_Object port)
{
- int fd = emacs_open (port, O_RDWR | O_NOCTTY | O_NONBLOCK, 0);
+ int fd = emacs_open (SSDATA (port), O_RDWR | O_NOCTTY | O_NONBLOCK, 0);
if (fd < 0)
- {
- error ("Could not open %s: %s",
- port, emacs_strerror (errno));
- }
+ report_file_error ("Opening serial port", port);
#ifdef TIOCEXCL
ioctl (fd, TIOCEXCL, (char *) 0);
#endif
@@ -2491,7 +2488,7 @@
/* Read port attributes and prepare default configuration. */
err = tcgetattr (p->outfd, &attr);
if (err != 0)
- error ("tcgetattr() failed: %s", emacs_strerror (errno));
+ report_file_error ("Failed tcgetattr", Qnil);
cfmakeraw (&attr);
#if defined (CLOCAL)
attr.c_cflag |= CLOCAL;
@@ -2508,8 +2505,7 @@
CHECK_NUMBER (tem);
err = cfsetspeed (&attr, XINT (tem));
if (err != 0)
- error ("cfsetspeed(%"pI"d) failed: %s", XINT (tem),
- emacs_strerror (errno));
+ report_file_error ("Failed cfsetspeed", tem);
childp2 = Fplist_put (childp2, QCspeed, tem);
/* Configure bytesize. */
@@ -2631,7 +2627,7 @@
/* Activate configuration. */
err = tcsetattr (p->outfd, TCSANOW, &attr);
if (err != 0)
- error ("tcsetattr() failed: %s", emacs_strerror (errno));
+ report_file_error ("Failed tcsetattr", Qnil);
childp2 = Fplist_put (childp2, QCsummary, build_string (summary));
pset_childp (p, childp2);
=== modified file 'src/systty.h'
--- a/src/systty.h 2013-01-02 16:13:04 +0000
+++ b/src/systty.h 2013-07-16 18:30:52 +0000
@@ -79,5 +79,5 @@
};
/* From sysdep.c or w32.c */
-extern int serial_open (char *);
+extern int serial_open (Lisp_Object);
extern void serial_configure (struct Lisp_Process *, Lisp_Object);
=== modified file 'src/w32.c'
--- a/src/w32.c 2013-07-07 18:48:16 +0000
+++ b/src/w32.c 2013-07-16 18:30:52 +0000
@@ -7707,8 +7707,9 @@
/* For make-serial-process */
int
-serial_open (char *port)
+serial_open (Lisp_Object port_obj)
{
+ char *port = SSDATA (port_obj);
HANDLE hnd;
child_process *cp;
int fd = -1;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] trunk r113435: Be simpler and more consistent about reporting I/O errors.,
Paul Eggert <=