From 8aa3a244a3eb61c7eddccf41a6c963530361276a Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Tue, 27 Jan 1998 20:07:30 +0000 Subject: [PATCH] (file_name_as_directory): For an empty name, return "/". --- src/fileio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/fileio.c b/src/fileio.c index 49d7de52bbe..6993003a8f1 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -484,11 +484,15 @@ file_name_as_directory (out, in) { int size = strlen (in) - 1; - if (size < 0) - error ("Empty file name"); - strcpy (out, in); + if (size < 0) + { + out[0] = '/'; + out[1] = 0; + return out; + } + #ifdef VMS /* Is it already a directory string? */ if (in[size] == ':' || in[size] == ']' || in[size] == '>') -- 2.39.2