comparison nnchat.c @ 172:ffba05eb578c

Make a copy of getenv("HOME") result instead of using it directly.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 15 Nov 2010 03:05:17 +0200
parents 35b1714eb3b2
children f5518f10dd1a
comparison
equal deleted inserted replaced
171:35b1714eb3b2 172:ffba05eb578c
858 char tmpPath[MAX_PATH]; 858 char tmpPath[MAX_PATH];
859 if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK) 859 if (SHGetFolderPath(NULL, CSIDL_APPDATA | CSIDL_FLAG_CREATE, NULL, 0, tmpPath) == S_OK)
860 homeDir = th_strdup(tmpPath); 860 homeDir = th_strdup(tmpPath);
861 } 861 }
862 #else 862 #else
863 homeDir = getenv("HOME"); 863 homeDir = th_strdup(getenv("HOME"));
864 #endif 864 #endif
865 865
866 if (homeDir != NULL) { 866 if (homeDir != NULL) {
867 FILE *cfgfile; 867 FILE *cfgfile;
868 setConfigFile = th_strdup_printf("%s" SET_DIR_SEPARATOR "%s", homeDir, SET_CONFIG_FILE); 868 setConfigFile = th_strdup_printf("%s" SET_DIR_SEPARATOR "%s", homeDir, SET_CONFIG_FILE);