comparison arogue5/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 46f39359c4a7
children f2951c4e28d9
comparison
equal deleted inserted replaced
94:ba9930a7f99d 95:88ab59f06dfc
62 #ifdef SAVEDIR 62 #ifdef SAVEDIR
63 if (argc >= 3 && !strcmp(argv[1], "-n")) { 63 if (argc >= 3 && !strcmp(argv[1], "-n")) {
64 use_savedir = TRUE; 64 use_savedir = TRUE;
65 strncpy(whoami, argv[2], LINELEN); 65 strncpy(whoami, argv[2], LINELEN);
66 whoami[LINELEN - 1] = '\0'; 66 whoami[LINELEN - 1] = '\0';
67 if (snprintf(file_name, LINELEN, "%s%d-%.10s.ar5sav", SAVEDIR, 67 if (snprintf(file_name, LINELEN, "%s/%d-%.10s.ar5sav", SAVEDIR,
68 md_getuid(), whoami) >= LINELEN) 68 md_getuid(), whoami) >= LINELEN)
69 { 69 {
70 /* The name is too long */ 70 /* The name is too long */
71 use_savedir = FALSE; 71 use_savedir = FALSE;
72 } 72 }