aboutsummaryrefslogtreecommitdiffstats
path: root/src/fileio.c
diff options
context:
space:
mode:
authorPaul Eggert2013-07-16 11:30:52 -0700
committerPaul Eggert2013-07-16 11:30:52 -0700
commit4e604a5d70c4f26abe8bb3494346c598389906b3 (patch)
tree6842a74fd23245cde0e5e4a97aa42ca32c119a0f /src/fileio.c
parenta9757f6a03cce5ff2931b1125a9a2249573c8e1c (diff)
downloademacs-4e604a5d70c4f26abe8bb3494346c598389906b3.tar.gz
emacs-4e604a5d70c4f26abe8bb3494346c598389906b3.zip
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.
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c22
1 files changed, 8 insertions, 14 deletions
diff --git a/src/fileio.c b/src/fileio.c
index ae9c15a0164..fba28f09273 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2125,7 +2125,7 @@ entries (depending on how Emacs was built). */)
2125 QUIT; 2125 QUIT;
2126 while ((n = emacs_read (ifd, buf, sizeof buf)) > 0) 2126 while ((n = emacs_read (ifd, buf, sizeof buf)) > 0)
2127 if (emacs_write_sig (ofd, buf, n) != n) 2127 if (emacs_write_sig (ofd, buf, n) != n)
2128 report_file_error ("I/O error", newname); 2128 report_file_error ("Write error", newname);
2129 immediate_quit = 0; 2129 immediate_quit = 0;
2130 2130
2131#ifndef MSDOS 2131#ifndef MSDOS
@@ -2182,7 +2182,7 @@ entries (depending on how Emacs was built). */)
2182 } 2182 }
2183 2183
2184 if (emacs_close (ofd) < 0) 2184 if (emacs_close (ofd) < 0)
2185 report_file_error ("I/O error", newname); 2185 report_file_error ("Write error", newname);
2186 2186
2187 emacs_close (ifd); 2187 emacs_close (ifd);
2188 2188
@@ -3697,8 +3697,7 @@ by calling `format-decode', which see. */)
3697 } 3697 }
3698 3698
3699 if (nread < 0) 3699 if (nread < 0)
3700 error ("IO error reading %s: %s", 3700 report_file_error ("Read error", orig_filename);
3701 SDATA (orig_filename), emacs_strerror (errno));
3702 else if (nread > 0) 3701 else if (nread > 0)
3703 { 3702 {
3704 struct buffer *prev = current_buffer; 3703 struct buffer *prev = current_buffer;
@@ -3813,8 +3812,7 @@ by calling `format-decode', which see. */)
3813 3812
3814 nread = emacs_read (fd, read_buf, sizeof read_buf); 3813 nread = emacs_read (fd, read_buf, sizeof read_buf);
3815 if (nread < 0) 3814 if (nread < 0)
3816 error ("IO error reading %s: %s", 3815 report_file_error ("Read error", orig_filename);
3817 SSDATA (orig_filename), emacs_strerror (errno));
3818 else if (nread == 0) 3816 else if (nread == 0)
3819 break; 3817 break;
3820 3818
@@ -3879,8 +3877,7 @@ by calling `format-decode', which see. */)
3879 { 3877 {
3880 nread = emacs_read (fd, read_buf + total_read, trial - total_read); 3878 nread = emacs_read (fd, read_buf + total_read, trial - total_read);
3881 if (nread < 0) 3879 if (nread < 0)
3882 error ("IO error reading %s: %s", 3880 report_file_error ("Read error", orig_filename);
3883 SDATA (orig_filename), emacs_strerror (errno));
3884 else if (nread == 0) 3881 else if (nread == 0)
3885 break; 3882 break;
3886 total_read += nread; 3883 total_read += nread;
@@ -4030,8 +4027,7 @@ by calling `format-decode', which see. */)
4030 deferred_remove_unwind_protect = 1; 4027 deferred_remove_unwind_protect = 1;
4031 4028
4032 if (this < 0) 4029 if (this < 0)
4033 error ("IO error reading %s: %s", 4030 report_file_error ("Read error", orig_filename);
4034 SDATA (orig_filename), emacs_strerror (errno));
4035 4031
4036 if (unprocessed > 0) 4032 if (unprocessed > 0)
4037 { 4033 {
@@ -4277,8 +4273,7 @@ by calling `format-decode', which see. */)
4277 specpdl_ptr--; 4273 specpdl_ptr--;
4278 4274
4279 if (how_much < 0) 4275 if (how_much < 0)
4280 error ("IO error reading %s: %s", 4276 report_file_error ("Read error", orig_filename);
4281 SDATA (orig_filename), emacs_strerror (errno));
4282 4277
4283 /* Make the text read part of the buffer. */ 4278 /* Make the text read part of the buffer. */
4284 GAP_SIZE -= inserted; 4279 GAP_SIZE -= inserted;
@@ -5071,8 +5066,7 @@ This calls `write-region-annotate-functions' at the start, and
5071 } 5066 }
5072 5067
5073 if (! ok) 5068 if (! ok)
5074 error ("IO error writing %s: %s", SDATA (filename), 5069 report_file_errno ("Write error", filename, save_errno);
5075 emacs_strerror (save_errno));
5076 5070
5077 if (visiting) 5071 if (visiting)
5078 { 5072 {