Avoid potentially unset variable in get_fname.c

This commit is contained in:
Bill Kendrick 2024-10-20 11:02:49 -07:00
parent df8f792cc3
commit f91923eddf
2 changed files with 8 additions and 3 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2024
Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/
2024.October.19 (0.9.34)
2024.October.20 (0.9.34)
* New Magic Tools:
----------------
* "Comic Dots", draws repeating dots (using a multiply blend)

View file

@ -1,7 +1,7 @@
/*
get_fname.c
Copyright (c) 2009 - 2022
Copyright (c) 2009 - 2024
https://tuxpaint.org/
This program is free software; you can redistribute it and/or modify
@ -19,7 +19,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: December 11, 2022
Last updated: October 20, 2024
$Id$
*/
@ -104,6 +104,11 @@ char *get_fname(const char *const name, int kind)
{
dir = exportdir;
}
else
{
/* Last resort! */
dir = "";
}
snprintf(f, sizeof(f), "%s%c%s", dir, (*name) ? '/' : '\0', /* Some mkdir()'s don't like trailing slashes */
name);