From dcfcf59f60388a7a6e874077416b5b2063fa067b Mon Sep 17 00:00:00 2001 From: HenryJacques Date: Tue, 3 May 2016 16:13:27 +0200 Subject: [PATCH] Fix segfault when using a relative folder name with disk redirection Until this commit using "-r disk:floppy=my_floppy" causes a segfault. You had to use "-r disk:floppy=./my_floppy" to use a folder in the current path. --- disk.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/disk.c b/disk.c index 31d07c0..223d64b 100644 --- a/disk.c +++ b/disk.c @@ -654,7 +654,10 @@ disk_query_information(RD_NTHANDLE handle, uint32 info_class, STREAM out) if (S_ISDIR(filestat.st_mode)) file_attributes |= FILE_ATTRIBUTE_DIRECTORY; - filename = 1 + strrchr(path, '/'); + filename = strrchr(path, '/'); + if (filename) + filename += 1; + if (filename && filename[0] == '.') file_attributes |= FILE_ATTRIBUTE_HIDDEN;