Commit e99a530f authored by Paul Eggert's avatar Paul Eggert
Browse files

Simplify by avoiding confusing use of strncpy etc.

parent c59592b3
2012-07-10 Paul Eggert <eggert@cs.ucla.edu>
Simplify by avoiding confusing use of strncpy etc.
* etags.c (write_classname, C_entries):
Use sprintf rather than strncpy or strncat.
* etags.c (consider_token, C_entries, HTML_labels, Prolog_functions)
(Erlang_functions, substitute, readline_internal, savenstr):
* movemail.c (mail_spool_name):
Use memcpy rather than strncpy or strncat when either will do.
* make-docfile.c (write_c_args):
Use memcmp rather than strncmp when either will do.
* movemail.c (pop_retr):
* pop.c (pop_stat, pop_list, pop_multi_first, pop_last)
(socket_connection, pop_getline, sendline, getok):
Use snprintf rather than strncpy or strncat.
* movemail.c (concat): Remove; no longer needed.
(xmalloc): Define only if needed, now that concat has gone away.
Return void *. All uses changed.
2012-07-09 Paul Eggert <eggert@cs.ucla.edu>
Add GCC-style 'const' attribute to functions that can use it.
......
......@@ -2642,17 +2642,11 @@ write_classname (linebuffer *cn, const char *qualifier)
}
for (i = 1; i < cstack.nl; i++)
{
char *s;
int slen;
s = cstack.cname[i];
char *s = cstack.cname[i];
if (s == NULL)
continue;
slen = strlen (s);
len += slen + qlen;
linebuffer_setlen (cn, len);
strncat (cn->buffer, qualifier, qlen);
strncat (cn->buffer, s, slen);
linebuffer_setlen (cn, len + qlen + strlen (s));
len += sprintf (cn->buffer + len, "%s%s", qualifier, s);
}
}
......@@ -2867,7 +2861,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext
fvdef = fvnone;
objdef = omethodtag;
linebuffer_setlen (&token_name, len);
strncpy (token_name.buffer, str, len);
memcpy (token_name.buffer, str, len);
token_name.buffer[len] = '\0';
return TRUE;
}
......@@ -2879,10 +2873,11 @@ consider_token (register char *str, register int len, register int c, int *c_ext
case omethodparm:
if (parlev == 0)
{
int oldlen = token_name.len;
fvdef = fvnone;
objdef = omethodtag;
linebuffer_setlen (&token_name, token_name.len + len);
strncat (token_name.buffer, str, len);
linebuffer_setlen (&token_name, oldlen + len);
memcpy (token_name.buffer + oldlen, str, len);
return TRUE;
}
return FALSE;
......@@ -3311,12 +3306,12 @@ C_entries (int c_ext, FILE *inf)
&& nestlev > 0 && definedef == dnone)
/* in struct body */
{
int len;
write_classname (&token_name, qualifier);
linebuffer_setlen (&token_name,
token_name.len+qlen+toklen);
strcat (token_name.buffer, qualifier);
strncat (token_name.buffer,
newlb.buffer + tokoff, toklen);
len = token_name.len;
linebuffer_setlen (&token_name, len+qlen+toklen);
sprintf (token_name.buffer + len, "%s%.*s",
qualifier, toklen, newlb.buffer + tokoff);
token.named = TRUE;
}
else if (objdef == ocatseen)
......@@ -3324,11 +3319,8 @@ C_entries (int c_ext, FILE *inf)
{
int len = strlen (objtag) + 2 + toklen;
linebuffer_setlen (&token_name, len);
strcpy (token_name.buffer, objtag);
strcat (token_name.buffer, "(");
strncat (token_name.buffer,
newlb.buffer + tokoff, toklen);
strcat (token_name.buffer, ")");
sprintf (token_name.buffer, "%s(%.*s)",
objtag, toklen, newlb.buffer + tokoff);
token.named = TRUE;
}
else if (objdef == omethodtag
......@@ -3352,8 +3344,8 @@ C_entries (int c_ext, FILE *inf)
len -= 1;
}
linebuffer_setlen (&token_name, len);
strncpy (token_name.buffer,
newlb.buffer + off, len);
memcpy (token_name.buffer,
newlb.buffer + off, len);
token_name.buffer[len] = '\0';
if (defun)
while (--len >= 0)
......@@ -3364,8 +3356,8 @@ C_entries (int c_ext, FILE *inf)
else
{
linebuffer_setlen (&token_name, toklen);
strncpy (token_name.buffer,
newlb.buffer + tokoff, toklen);
memcpy (token_name.buffer,
newlb.buffer + tokoff, toklen);
token_name.buffer[toklen] = '\0';
/* Name macros and members. */
token.named = (structdef == stagseen
......@@ -5161,7 +5153,7 @@ HTML_labels (FILE *inf)
for (end = dbp; *end != '\0' && intoken (*end); end++)
continue;
linebuffer_setlen (&token_name, end - dbp);
strncpy (token_name.buffer, dbp, end - dbp);
memcpy (token_name.buffer, dbp, end - dbp);
token_name.buffer[end - dbp] = '\0';
dbp = end;
......@@ -5261,7 +5253,7 @@ Prolog_functions (FILE *inf)
else if (len + 1 > allocated)
xrnew (last, len + 1, char);
allocated = len + 1;
strncpy (last, cp, len);
memcpy (last, cp, len);
last[len] = '\0';
}
}
......@@ -5434,7 +5426,7 @@ Erlang_functions (FILE *inf)
else if (len + 1 > allocated)
xrnew (last, len + 1, char);
allocated = len + 1;
strncpy (last, cp, len);
memcpy (last, cp, len);
last[len] = '\0';
}
}
......@@ -5817,7 +5809,7 @@ substitute (char *in, char *out, struct re_registers *regs)
{
dig = *out - '0';
diglen = regs->end[dig] - regs->start[dig];
strncpy (t, in + regs->start[dig], diglen);
memcpy (t, in + regs->start[dig], diglen);
t += diglen;
}
else
......@@ -6040,7 +6032,7 @@ readline_internal (linebuffer *lbp, register FILE *stream)
filebuf.size *= 2;
xrnew (filebuf.buffer, filebuf.size, char);
}
strncpy (filebuf.buffer + filebuf.len, lbp->buffer, lbp->len);
memcpy (filebuf.buffer + filebuf.len, lbp->buffer, lbp->len);
filebuf.len += lbp->len;
filebuf.buffer[filebuf.len++] = '\n';
filebuf.buffer[filebuf.len] = '\0';
......@@ -6263,7 +6255,7 @@ savenstr (const char *cp, int len)
register char *dp;
dp = xnew (len + 1, char);
strncpy (dp, cp, len);
memcpy (dp, cp, len);
dp[len] = '\0';
return dp;
}
......
......@@ -541,7 +541,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
/* In C code, `default' is a reserved word, so we spell it
`defalt'; demangle that here. */
if (ident_length == 6 && strncmp (ident_start, "defalt", 6) == 0)
if (ident_length == 6 && memcmp (ident_start, "defalt", 6) == 0)
fprintf (out, "DEFAULT");
else
while (ident_length-- > 0)
......
......@@ -141,8 +141,9 @@ static _Noreturn void fatal (const char *s1, const char *s2, const char *s3);
static void error (const char *s1, const char *s2, const char *s3);
static _Noreturn void pfatal_with_name (char *name);
static _Noreturn void pfatal_and_delete (char *name);
static char *concat (const char *s1, const char *s2, const char *s3);
static long *xmalloc (unsigned int size);
#ifdef MAIL_USE_MAILLOCK
static void *xmalloc (size_t size);
#endif
#ifdef MAIL_USE_POP
static int popmail (char *mailbox, char *outfile, int preserve, char *password, int reverse_order);
static int pop_retr (popserver server, int msgno, FILE *arg);
......@@ -301,7 +302,7 @@ main (int argc, char **argv)
inname_dirlen && !IS_DIRECTORY_SEP (inname[inname_dirlen - 1]);
inname_dirlen--)
continue;
tempname = (char *) xmalloc (inname_dirlen + sizeof "EXXXXXX");
tempname = xmalloc (inname_dirlen + sizeof "EXXXXXX");
while (1)
{
......@@ -583,8 +584,8 @@ mail_spool_name (char *inname)
if (stat (MAILDIR, &stat1) < 0)
return NULL;
indir = (char *) xmalloc (fname - inname + 1);
strncpy (indir, inname, fname - inname);
indir = xmalloc (fname - inname + 1);
memcpy (indir, inname, fname - inname);
indir[fname-inname] = '\0';
......@@ -644,32 +645,18 @@ pfatal_and_delete (char *name)
fatal ("%s for %s", s, name);
}
/* Return a newly-allocated string whose contents concatenate those of s1, s2, s3. */
static char *
concat (const char *s1, const char *s2, const char *s3)
{
size_t len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
char *result = (char *) xmalloc (len1 + len2 + len3 + 1);
strcpy (result, s1);
strcpy (result + len1, s2);
strcpy (result + len1 + len2, s3);
*(result + len1 + len2 + len3) = 0;
return result;
}
#ifdef MAIL_USE_MAILLOCK
/* Like malloc but get fatal error if memory is exhausted. */
static long *
xmalloc (unsigned int size)
static void *
xmalloc (size_t size)
{
long *result = (long *) malloc (size);
void *result = malloc (size);
if (!result)
fatal ("virtual memory exhausted", 0, 0);
return result;
}
#endif
/* This is the guts of the interface to the Post Office Protocol. */
......@@ -851,10 +838,7 @@ pop_retr (popserver server, int msgno, FILE *arg)
if (pop_retrieve_first (server, msgno, &line))
{
char *msg = concat ("Error from POP server: ", pop_error, "");
strncpy (Errmsg, msg, sizeof (Errmsg));
Errmsg[sizeof (Errmsg)-1] = '\0';
free (msg);
snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error);
return (NOTOK);
}
......@@ -873,10 +857,7 @@ pop_retr (popserver server, int msgno, FILE *arg)
if (ret)
{
char *msg = concat ("Error from POP server: ", pop_error, "");
strncpy (Errmsg, msg, sizeof (Errmsg));
Errmsg[sizeof (Errmsg)-1] = '\0';
free (msg);
snprintf (Errmsg, sizeof Errmsg, "Error from POP server: %s", pop_error);
return (NOTOK);
}
......
......@@ -340,10 +340,7 @@ pop_stat (popserver server, int *count, int *size)
if (strncmp (fromserver, "+OK ", 4))
{
if (0 == strncmp (fromserver, "-ERR", 4))
{
strncpy (pop_error, fromserver, ERROR_MAX);
pop_error[ERROR_MAX-1] = '\0';
}
snprintf (pop_error, ERROR_MAX, "%s", fromserver);
else
{
strcpy (pop_error,
......@@ -444,10 +441,7 @@ pop_list (popserver server, int message, int **IDs, int **sizes)
if (strncmp (fromserver, "+OK ", 4))
{
if (! strncmp (fromserver, "-ERR", 4))
{
strncpy (pop_error, fromserver, ERROR_MAX);
pop_error[ERROR_MAX-1] = '\0';
}
snprintf (pop_error, ERROR_MAX, "%s", fromserver);
else
{
strcpy (pop_error,
......@@ -686,8 +680,7 @@ pop_multi_first (popserver server, const char *command, char **response)
if (0 == strncmp (*response, "-ERR", 4))
{
strncpy (pop_error, *response, ERROR_MAX);
pop_error[ERROR_MAX-1] = '\0';
snprintf (pop_error, ERROR_MAX, "%s", *response);
return (-1);
}
else if (0 == strncmp (*response, "+OK", 3))
......@@ -860,8 +853,7 @@ pop_last (popserver server)
if (! strncmp (fromserver, "-ERR", 4))
{
strncpy (pop_error, fromserver, ERROR_MAX);
pop_error[ERROR_MAX-1] = '\0';
snprintf (pop_error, ERROR_MAX, "%s", fromserver);
return (-1);
}
else if (strncmp (fromserver, "+OK ", 4))
......@@ -1061,9 +1053,8 @@ socket_connection (char *host, int flags)
sock = socket (PF_INET, SOCK_STREAM, 0);
if (sock < 0)
{
strcpy (pop_error, POP_SOCKET_ERROR);
strncat (pop_error, strerror (errno),
ERROR_MAX - sizeof (POP_SOCKET_ERROR));
snprintf (pop_error, ERROR_MAX, "%s%s",
POP_SOCKET_ERROR, strerror (errno));
return (-1);
}
......@@ -1139,9 +1130,7 @@ socket_connection (char *host, int flags)
if (! connect_ok)
{
CLOSESOCKET (sock);
strcpy (pop_error, CONNECT_ERROR);
strncat (pop_error, strerror (errno),
ERROR_MAX - sizeof (CONNECT_ERROR));
snprintf (pop_error, ERROR_MAX, "%s%s", CONNECT_ERROR, strerror (errno));
return (-1);
}
......@@ -1159,9 +1148,8 @@ socket_connection (char *host, int flags)
krb5_auth_con_free (kcontext, auth_context);
if (kcontext)
krb5_free_context (kcontext);
strcpy (pop_error, KRB_ERROR);
strncat (pop_error, error_message (rem),
ERROR_MAX - sizeof (KRB_ERROR));
snprintf (pop_error, ERROR_MAX, "%s%s",
KRB_ERROR, error_message (rem));
CLOSESOCKET (sock);
return (-1);
}
......@@ -1199,30 +1187,19 @@ socket_connection (char *host, int flags)
krb5_free_principal (kcontext, server);
if (rem)
{
strcpy (pop_error, KRB_ERROR);
strncat (pop_error, error_message (rem),
ERROR_MAX - sizeof (KRB_ERROR));
int pop_error_len = snprintf (pop_error, ERROR_MAX, "%s%s",
KRB_ERROR, error_message (rem));
#if defined HAVE_KRB5_ERROR_TEXT
if (err_ret && err_ret->text.length)
{
strncat (pop_error, " [server says '",
ERROR_MAX - strlen (pop_error) - 1);
strncat (pop_error, err_ret->text.data,
min (ERROR_MAX - strlen (pop_error) - 1,
err_ret->text.length));
strncat (pop_error, "']",
ERROR_MAX - strlen (pop_error) - 1);
int errlen = err_ret->text.length;
snprintf (pop_error + pop_error_len, ERROR_MAX - pop_error_len,
" [server says '.*%s']", errlen, err_ret->text.data);
}
#elif defined HAVE_KRB5_ERROR_E_TEXT
if (err_ret && err_ret->e_text && strlen (*err_ret->e_text))
{
strncat (pop_error, " [server says '",
ERROR_MAX - strlen (pop_error) - 1);
strncat (pop_error, *err_ret->e_text,
ERROR_MAX - strlen (pop_error) - 1);
strncat (pop_error, "']",
ERROR_MAX - strlen (pop_error) - 1);
}
if (err_ret && err_ret->e_text && **err_ret->e_text)
snprintf (pop_error + pop_error_len, ERRMAX - pop_error_len,
" [server says '%s']", *err_ret->e_text);
#endif
if (err_ret)
krb5_free_error (kcontext, err_ret);
......@@ -1243,9 +1220,7 @@ socket_connection (char *host, int flags)
free ((char *) ticket);
if (rem != KSUCCESS)
{
strcpy (pop_error, KRB_ERROR);
strncat (pop_error, krb_err_txt[rem],
ERROR_MAX - sizeof (KRB_ERROR));
snprintf (pop_error, ERROR_MAX, "%s%s", KRB_ERROR, krb_err_txt[rem]);
CLOSESOCKET (sock);
return (-1);
}
......@@ -1350,9 +1325,8 @@ pop_getline (popserver server, char **line)
server->buffer_size - server->data - 1, 0);
if (ret < 0)
{
strcpy (pop_error, GETLINE_ERROR);
strncat (pop_error, strerror (errno),
ERROR_MAX - sizeof (GETLINE_ERROR));
snprintf (pop_error, ERROR_MAX, "%s%s",
GETLINE_ERROR, strerror (errno));
pop_trash (server);
return (-1);
}
......@@ -1436,9 +1410,7 @@ sendline (popserver server, const char *line)
if (ret < 0)
{
pop_trash (server);
strcpy (pop_error, SENDLINE_ERROR);
strncat (pop_error, strerror (errno),
ERROR_MAX - sizeof (SENDLINE_ERROR));
snprintf (pop_error, ERROR_MAX, "%s%s", SENDLINE_ERROR, strerror (errno));
return (ret);
}
......@@ -1500,8 +1472,7 @@ getok (popserver server)
return (0);
else if (! strncmp (fromline, "-ERR", 4))
{
strncpy (pop_error, fromline, ERROR_MAX);
pop_error[ERROR_MAX-1] = '\0';
snprintf (pop_error, ERROR_MAX, "%s", fromline);
return (-1);
}
else
......
2012-07-10 Paul Eggert <eggert@cs.ucla.edu>
Simplify by avoiding confusing use of strncpy etc.
* doc.c (Fsnarf_documentation):
* fileio.c (Ffile_name_directory, Fsubstitute_in_file_name):
* frame.c (Fmake_terminal_frame):
* gtkutil.c (get_utf8_string):
* lread.c (openp):
* nsmenu.m (ns_update_menubar):
* regex.c (regerror):
Prefer memcpy to strncpy and strncat when either will do.
* fileio.c (Fsubstitute_in_file_name):
* keyboard.c (MULTI_LETTER_MOD, parse_modifiers_uncached)
(menu_separator_name_p):
* nsmenu.m (ns_update_menubar):
Prefer memcmp to strncmp when either will do.
* nsterm.m: Include <ftoastr.h>.
(ns_get_color):
* s/gnu-linux.h, s/sol2-6.h, s/unixware.h (PTY_TTY_NAME_SPRINTF):
Prefer snprintf to strncpy.
* nsterm.m (ns_term_init):
* widget.c (set_frame_size) [0]: Prefer xstrdup to xmalloc + strncpy.
* nsterm.m (ns_term_init):
Avoid the need for strncpy, by using build_string or
make_unibyte_string directly. Use dtoastr, not snprintf.
* process.c (Fmake_network_process): Diagnose service names that
are too long, rather than silently truncating them or creating
non-null-terminated names.
(Fnetwork_interface_info): Likewise, for interface names.
* sysdep.c (system_process_attributes) [GNU_LINUX]:
Prefer sprintf to strncat.
* xdisp.c (debug_method_add) [GLYPH_DEBUG]:
Prefer vsnprintf to vsprintf + strncpy.
2012-07-10 Glenn Morris <rgm@gnu.org>
* dispnew.c (PENDING_OUTPUT_COUNT) [!__GNU_LIBRARY__]:
......
......@@ -645,7 +645,7 @@ the same file name is found in the `doc-directory'. */)
{
ptrdiff_t len = end - p - 2;
char *fromfile = alloca (len + 1);
strncpy (fromfile, &p[2], len);
memcpy (fromfile, &p[2], len);
fromfile[len] = 0;
if (fromfile[len-1] == 'c')
fromfile[len-1] = 'o';
......
......@@ -365,7 +365,7 @@ Given a Unix syntax file name, returns a string ending in slash. */)
if (p == beg + 4 && IS_DIRECTORY_SEP (*beg) && beg[1] == ':')
{
strncpy (res, beg, 2);
memcpy (res, beg, 2);
beg += 2;
r += 2;
}
......@@ -1648,7 +1648,7 @@ those `/' is discarded. */)
/* Copy out the variable name. */
target = alloca (s - o + 1);
strncpy (target, o, s - o);
memcpy (target, o, s - o);
target[s - o] = 0;
#ifdef DOS_NT
strupr (target); /* $home == $HOME etc. */
......@@ -1711,7 +1711,7 @@ those `/' is discarded. */)
/* Copy out the variable name. */
target = alloca (s - o + 1);
strncpy (target, o, s - o);
memcpy (target, o, s - o);
target[s - o] = 0;
#ifdef DOS_NT
strupr (target); /* $home == $HOME etc. */
......@@ -1732,13 +1732,13 @@ those `/' is discarded. */)
orig = make_unibyte_string (o, orig_length);
decoded = DECODE_FILE (orig);
decoded_length = SBYTES (decoded);
strncpy (x, SSDATA (decoded), decoded_length);
memcpy (x, SDATA (decoded), decoded_length);
x += decoded_length;
/* If environment variable needed decoding, return value
needs to be multibyte. */
if (decoded_length != orig_length
|| strncmp (SSDATA (decoded), o, orig_length))
|| memcmp (SDATA (decoded), o, orig_length))
multibyte = 1;
}
}
......
......@@ -646,7 +646,7 @@ affects all frames on the same terminal device. */)
if (!NILP (tty))
{
name = alloca (SBYTES (tty) + 1);
strncpy (name, SSDATA (tty), SBYTES (tty));
memcpy (name, SSDATA (tty), SBYTES (tty));
name[SBYTES (tty)] = 0;
}
......@@ -657,7 +657,7 @@ affects all frames on the same terminal device. */)
if (!NILP (tty_type))
{
type = alloca (SBYTES (tty_type) + 1);
strncpy (type, SSDATA (tty_type), SBYTES (tty_type));
memcpy (type, SSDATA (tty_type), SBYTES (tty_type));
type[SBYTES (tty_type)] = 0;
}
......
......@@ -529,7 +529,7 @@ get_utf8_string (const char *str)
&bytes_written, &err))
&& err->code == G_CONVERT_ERROR_ILLEGAL_SEQUENCE)
{
strncpy (up, (char *)p, bytes_written);
memcpy (up, p, bytes_written);
sprintf (up + bytes_written, "\\%03o", p[bytes_written]);
up += bytes_written+4;
p += bytes_written+1;
......
......@@ -6134,7 +6134,7 @@ parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t *modifier_end)
#define MULTI_LETTER_MOD(BIT, NAME, LEN) \
if (i + LEN + 1 <= SBYTES (name) \
&& ! strncmp (SSDATA (name) + i, NAME, LEN)) \
&& ! memcmp (SDATA (name) + i, NAME, LEN)) \
{ \
this_mod_end = i + LEN; \
this_mod = BIT; \
......@@ -6172,13 +6172,13 @@ parse_modifiers_uncached (Lisp_Object symbol, ptrdiff_t *modifier_end)
if (! (modifiers & (down_modifier | drag_modifier
| double_modifier | triple_modifier))
&& i + 7 == SBYTES (name)
&& strncmp (SSDATA (name) + i, "mouse-", 6) == 0
&& memcmp (SDATA (name) + i, "mouse-", 6) == 0
&& ('0' <= SREF (name, i + 6) && SREF (name, i + 6) <= '9'))
modifiers |= click_modifier;
if (! (modifiers & (double_modifier | triple_modifier))
&& i + 6 < SBYTES (name)
&& strncmp (SSDATA (name) + i, "wheel-", 6) == 0)
&& memcmp (SDATA (name) + i, "wheel-", 6) == 0)
modifiers |= click_modifier;
if (modifier_end)
......@@ -6630,7 +6630,7 @@ parse_solitary_modifier (Lisp_Object symbol)
#define MULTI_LETTER_MOD(BIT, NAME, LEN) \
if (LEN == SBYTES (name) \
&& ! strncmp (SSDATA (name), NAME, LEN)) \
&& ! memcmp (SDATA (name), NAME, LEN)) \
return BIT;
case 'A':
......@@ -7418,7 +7418,7 @@ menu_separator_name_p (const char *label)
if (!label)
return 0;
else if (strlen (label) > 3
&& strncmp (label, "--", 2) == 0
&& memcmp (label, "--", 2) == 0
&& label[2] != '-')
{
int i;
......
......@@ -1495,26 +1495,14 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
/* Concatenate path element/specified name with the suffix.
If the directory starts with /:, remove that. */
if (SCHARS (filename) > 2
&& SREF (filename, 0) == '/'
&& SREF (filename, 1) == ':')
{
fnlen = SBYTES (filename) - 2;
strncpy (fn, SSDATA (filename) + 2, fnlen);
fn[fnlen] = '\0';
}
else
{
fnlen = SBYTES (filename);
strncpy (fn, SSDATA (filename), fnlen);
fn[fnlen] = '\0';
}
if (lsuffix != 0) /* Bug happens on CCI if lsuffix is 0. */
{
strncat (fn, SSDATA (XCAR (tail)), lsuffix);
fnlen += lsuffix;
}
int prefixlen = ((SCHARS (filename) > 2
&& SREF (filename, 0) == '/'
&& SREF (filename, 1) == ':')
? 2 : 0);
fnlen = SBYTES (filename) - prefixlen;
memcpy (fn, SDATA (filename) + prefixlen, fnlen);
memcpy (fn + fnlen, SDATA (XCAR (tail)), lsuffix + 1);
fnlen += lsuffix;
/* Check that the file exists and is not a directory. */
/* We used to only check for handlers on non-absolute file names:
if (absolute)
......
......@@ -426,7 +426,8 @@
break;
else
continue;