Mercurial > hg > early-roguelike
comparison rogue4/main.c @ 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 | 24e6beb9e7aa |
children | f2951c4e28d9 |
comparison
equal
deleted
inserted
replaced
94:ba9930a7f99d | 95:88ab59f06dfc |
---|---|
76 { | 76 { |
77 strncpy(whoami, argv[2], MAXSTR - 1); | 77 strncpy(whoami, argv[2], MAXSTR - 1); |
78 whoami[MAXSTR - 1] = '\0'; /* insurance */ | 78 whoami[MAXSTR - 1] = '\0'; /* insurance */ |
79 use_savedir = TRUE; | 79 use_savedir = TRUE; |
80 /* look for savefile at SAVEDIR/UID-playername.r4sav */ | 80 /* look for savefile at SAVEDIR/UID-playername.r4sav */ |
81 if (snprintf(file_name, MAXSTR, "%s%d-%.10s.r4sav", SAVEDIR, | 81 if (snprintf(file_name, MAXSTR, "%s/%d-%.10s.r4sav", SAVEDIR, |
82 md_getuid(), whoami) >= MAXSTR) | 82 md_getuid(), whoami) >= MAXSTR) |
83 { | 83 { |
84 /* Name is too long- this shouldn't happen */ | 84 /* Name is too long- this shouldn't happen */ |
85 strcpy(file_name, "rogue4.save"); | 85 strcpy(file_name, "rogue4.save"); |
86 use_savedir = FALSE; | 86 use_savedir = FALSE; |