Mercurial > hg > early-roguelike
changeset 95:88ab59f06dfc
Make sure file_name contains '/' between SAVEDIR and the file name.
Duplicated slashes are not a problem. Missing slashes are.
author | John "Elwin" Edwards |
---|---|
date | Tue, 27 Aug 2013 22:25:40 -0700 |
parents | ba9930a7f99d |
children | 9fb343307b6b |
files | arogue5/main.c rogue3/main.c rogue4/main.c srogue/main.c |
diffstat | 4 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/arogue5/main.c Tue Aug 27 09:25:30 2013 -0700 +++ b/arogue5/main.c Tue Aug 27 22:25:40 2013 -0700 @@ -64,7 +64,7 @@ use_savedir = TRUE; strncpy(whoami, argv[2], LINELEN); whoami[LINELEN - 1] = '\0'; - if (snprintf(file_name, LINELEN, "%s%d-%.10s.ar5sav", SAVEDIR, + if (snprintf(file_name, LINELEN, "%s/%d-%.10s.ar5sav", SAVEDIR, md_getuid(), whoami) >= LINELEN) { /* The name is too long */
--- a/rogue3/main.c Tue Aug 27 09:25:30 2013 -0700 +++ b/rogue3/main.c Tue Aug 27 22:25:40 2013 -0700 @@ -71,7 +71,7 @@ whoami[79] = '\0'; use_savedir = TRUE; /* look for savefile at SAVEDIR/UID-playername.r3sav */ - if (snprintf(file_name, 80, "%s%d-%.10s.r3sav", SAVEDIR, md_getuid(), whoami) >= 80) + if (snprintf(file_name, 80, "%s/%d-%.10s.r3sav", SAVEDIR, md_getuid(), whoami) >= 80) { /* this shouldn't happen */ strcpy(file_name, "rogue3.save");
--- a/rogue4/main.c Tue Aug 27 09:25:30 2013 -0700 +++ b/rogue4/main.c Tue Aug 27 22:25:40 2013 -0700 @@ -78,7 +78,7 @@ whoami[MAXSTR - 1] = '\0'; /* insurance */ use_savedir = TRUE; /* look for savefile at SAVEDIR/UID-playername.r4sav */ - if (snprintf(file_name, MAXSTR, "%s%d-%.10s.r4sav", SAVEDIR, + if (snprintf(file_name, MAXSTR, "%s/%d-%.10s.r4sav", SAVEDIR, md_getuid(), whoami) >= MAXSTR) { /* Name is too long- this shouldn't happen */
--- a/srogue/main.c Tue Aug 27 09:25:30 2013 -0700 +++ b/srogue/main.c Tue Aug 27 22:25:40 2013 -0700 @@ -120,7 +120,7 @@ strncpy(whoami, argv[2], LINLEN); whoami[LINLEN - 1] = '\0'; use_savedir = TRUE; - if (snprintf(file_name, LINLEN, "%s%d-%.10s.srsav", SAVEDIR, + if (snprintf(file_name, LINLEN, "%s/%d-%.10s.srsav", SAVEDIR, playuid, whoami) >= LINLEN) { /* Just in case it doesn't fit */ strcpy(file_name, "srogue.save");