comparison srogue/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 8757a0593e6e
children 1e88eb1942a5
comparison
equal deleted inserted replaced
94:ba9930a7f99d 95:88ab59f06dfc
118 #ifdef SAVEDIR 118 #ifdef SAVEDIR
119 if (argc >= 3 && !strcmp(argv[1], "-n")) { 119 if (argc >= 3 && !strcmp(argv[1], "-n")) {
120 strncpy(whoami, argv[2], LINLEN); 120 strncpy(whoami, argv[2], LINLEN);
121 whoami[LINLEN - 1] = '\0'; 121 whoami[LINLEN - 1] = '\0';
122 use_savedir = TRUE; 122 use_savedir = TRUE;
123 if (snprintf(file_name, LINLEN, "%s%d-%.10s.srsav", SAVEDIR, 123 if (snprintf(file_name, LINLEN, "%s/%d-%.10s.srsav", SAVEDIR,
124 playuid, whoami) >= LINLEN) { 124 playuid, whoami) >= LINLEN) {
125 /* Just in case it doesn't fit */ 125 /* Just in case it doesn't fit */
126 strcpy(file_name, "srogue.save"); 126 strcpy(file_name, "srogue.save");
127 use_savedir = FALSE; 127 use_savedir = FALSE;
128 } 128 }