summaryrefslogtreecommitdiff
path: root/src/fileio.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/fileio.c')
-rw-r--r--src/fileio.c18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/fileio.c b/src/fileio.c
index 13c99bee109..a0563ccba4b 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -945,6 +945,7 @@ the root directory. */)
USE_SAFE_ALLOCA;
CHECK_STRING (name);
+ CHECK_STRING_NULL_BYTES (name);
/* If the file name has special constructs in it,
call the corresponding file name handler. */
@@ -993,7 +994,10 @@ the root directory. */)
if (STRINGP (dir))
{
if (file_name_absolute_no_tilde_p (dir))
- default_directory = dir;
+ {
+ CHECK_STRING_NULL_BYTES (dir);
+ default_directory = dir;
+ }
else
{
Lisp_Object absdir
@@ -1307,6 +1311,8 @@ the root directory. */)
newdir = SSDATA (hdir);
newdirlim = newdir + SBYTES (hdir);
}
+ else if (!multibyte && STRING_MULTIBYTE (tem))
+ multibyte = 1;
#ifdef DOS_NT
collapse_newdir = false;
#endif
@@ -2280,6 +2286,7 @@ permissions. */)
off_t insize = st.st_size;
ssize_t copied;
+#ifndef MSDOS
for (newsize = 0; newsize < insize; newsize += copied)
{
/* Copy at most COPY_MAX bytes at a time; this is min
@@ -2294,6 +2301,7 @@ permissions. */)
break;
maybe_quit ();
}
+#endif /* MSDOS */
/* Fall back on read+write if copy_file_range failed, or if the
input is empty and so could be a /proc file. read+write will
@@ -2380,7 +2388,9 @@ permissions. */)
if (!NILP (keep_time))
{
- struct timespec ts[] = { get_stat_atime (&st), get_stat_mtime (&st) };
+ struct timespec ts[2];
+ ts[0] = get_stat_atime (&st);
+ ts[1] = get_stat_mtime (&st);
if (futimens (ofd, ts) != 0)
xsignal2 (Qfile_date_error,
build_string ("Cannot set file date"), newname);
@@ -3823,7 +3833,7 @@ restore_window_points (Lisp_Object window_markers, ptrdiff_t inserted,
Lisp_Object oldpos = XCDR (car);
if (MARKERP (marker) && FIXNUMP (oldpos)
&& XFIXNUM (oldpos) > same_at_start
- && XFIXNUM (oldpos) < same_at_end)
+ && XFIXNUM (oldpos) <= same_at_end)
{
ptrdiff_t oldsize = same_at_end - same_at_start;
ptrdiff_t newsize = inserted;
@@ -6184,7 +6194,7 @@ before any other event (mouse or keypress) is handled. */)
(void)
{
#if (defined USE_GTK || defined USE_MOTIF \
- || defined HAVE_NS || defined HAVE_NTGUI)
+ || defined HAVE_NS || defined HAVE_NTGUI || defined HAVE_HAIKU)
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
&& use_dialog_box
&& use_file_dialog