diff --git a/src/systemtime/date.c b/src/systemtime/date.c index e402fa7..d7cfcc3 100644 --- a/src/systemtime/date.c +++ b/src/systemtime/date.c @@ -39,8 +39,8 @@ #include #include -char path[100]; //用户修改后配置文件路径 -#define PATH_MAX 100 +char path[512] = {0}; //用户修改后配置文件路径 +#define PATH_MAX_H 4096 #define LOCALEDIR "/usr/share/locale/" #define GETTEXT_PACKAGE "kysdk-date" @@ -78,7 +78,7 @@ static void *printDate(DBusConnection *ptr) char tmp[40] = {0}; GKeyFile *config = g_key_file_new(); char *lang = getenv("LANG"); - char canonical_filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time) { @@ -255,7 +255,7 @@ static void *print_longDate(DBusConnection *ptr) char tmp[64] = "\0"; GKeyFile *config = g_key_file_new(); char *lang = getenv("LANG"); - char canonical_filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; g_key_file_load_from_file(config, path, 0, NULL); @@ -343,7 +343,7 @@ static void *print_shortDate(DBusConnection *ptr) goto out; } GKeyFile *config = g_key_file_new(); - char canonical_filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; char *lang = getenv("LANG"); char *env_time = getenv("LC_TIME"); if(!env_time) @@ -541,10 +541,10 @@ void *actionDateChanged(void *ptr) { DBusConnection *conn = NULL; conn = ptr; - char strpath[128] = "\0"; - char canonical_filename[100] = "\0"; - char filename[100] = "\0"; - char fname[100] = "\0"; + char strpath[512] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; + char fname[PATH_MAX_H] = "\0"; int fd = inotify_init(); @@ -646,7 +646,7 @@ int monitorSystemDateChange(int fd){ char *homeDir = NULL; char *realpath_res = NULL; - char filename[100] = "\0"; + char filename[PATH_MAX_H] = "\0"; homeDir = getenv("HOME"); if (!realpath(homeDir, filename) || !verify_file(filename)) diff --git a/src/systemtime/libkydate.c b/src/systemtime/libkydate.c index 9ac022b..dc5816c 100644 --- a/src/systemtime/libkydate.c +++ b/src/systemtime/libkydate.c @@ -44,9 +44,9 @@ #define LOCALEDIR "/usr/share/locale/" #define GETTEXT_PACKAGE "kysdk-date" #define MAXSIZE 80 -#define PATH_MAX 100 +#define PATH_MAX_H 4096 -char path[256] = {0}; //用户修改后配置文件路径 +char path[512] = {0}; //用户修改后配置文件路径 uint verify_file(char *pFileName) { @@ -334,8 +334,8 @@ int kdk_system_set_dateformat(char *date) GError* gerr = NULL; int status; int mark = 0; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time) @@ -477,8 +477,8 @@ int kdk_system_set_24_timeformat() char *homeDir = NULL; int status = 0; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; homeDir = getenv("HOME"); if (!realpath(homeDir, filename) || !verify_file(filename)) @@ -525,8 +525,8 @@ int kdk_system_set_12_timeformat() GError *gerr = NULL; int status = 0; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; homeDir = getenv("HOME"); if (!realpath(homeDir, filename) || !verify_file(filename)) @@ -574,8 +574,8 @@ char* kdk_system_get_now_dateformat() char *homeDir = NULL; char *value = NULL; char *tvalue = malloc(sizeof(char) * 128); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; homeDir = getenv("HOME"); if (!realpath(homeDir, filename) || !verify_file(filename)) @@ -646,8 +646,8 @@ char* kdk_system_get_now_timeformat() char *homeDir = NULL; char value[64] = "\0"; char *tvalue = malloc(sizeof(char) * 128); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; homeDir = getenv("HOME"); if (!realpath(homeDir, filename) || !verify_file(filename)) @@ -729,8 +729,8 @@ kdk_dateinfo *kdk_system_tran_dateformat(struct tm *ptr) char tmp[128] = "\0"; char tmpe[128] = "\0"; char stmp[128] = "\0"; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time) @@ -945,8 +945,8 @@ char* kdk_system_nowtime() char *tvalue = (char*)malloc(sizeof(char) * 64); char *value = (char*)malloc(sizeof(char) * 128); GKeyFile *config = g_key_file_new(); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *lang = getenv("LANG"); homeDir = getenv("HOME"); @@ -1043,8 +1043,8 @@ char* kdk_system_nowdate() char *tvalue = malloc(sizeof(char) * 64); char *value = malloc(sizeof(char) * 128); GKeyFile *config = g_key_file_new(); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time) @@ -1400,8 +1400,8 @@ char* kdk_system_second() char *tvalue = (char *)malloc(sizeof(char) * 64); char *value = (char *)malloc(sizeof(char) * 128); GKeyFile *config = g_key_file_new(); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *lang = getenv("LANG"); homeDir = getenv("HOME"); @@ -1638,8 +1638,8 @@ char* kdk_system_gjx_time(char *date) char *tvalue = (char *)malloc(sizeof(char) * 64); char *value = (char*)malloc(sizeof(char) * 128); GKeyFile *config = g_key_file_new(); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time) @@ -1835,8 +1835,8 @@ int kdk_system_set_long_dateformat(char *format) GKeyFile *config = g_key_file_new(); GError* gerr = NULL; int status = 0; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; homeDir = getenv("HOME"); if (!realpath(homeDir, filename) || !verify_file(filename)) @@ -1937,8 +1937,8 @@ int kdk_system_set_short_dateformat(char *format) GError* gerr = NULL; int status = 0; int mark = 0; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; int sdate = 0; int len = 0; @@ -1977,7 +1977,7 @@ int kdk_system_set_short_dateformat(char *format) memset(path, 0, sizeof(path)); sprintf(path, "%s/.config/kydate/dateformat.conf", canonical_filename); - char tpath[100] = {0}; + char tpath[512] = {0}; char *home = getlogin(); @@ -2077,8 +2077,8 @@ char* kdk_system_get_longformat_date() return NULL; } GKeyFile *config = g_key_file_new(); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *lang = getenv("LANG"); homeDir = getenv("HOME"); @@ -2164,8 +2164,8 @@ char* kdk_system_get_shortformat_date() return NULL; } GKeyFile *config = g_key_file_new(); - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time) @@ -2287,8 +2287,8 @@ char* kdk_system_get_longformat() { return NULL; } - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; homeDir = getenv("HOME"); if (!realpath(homeDir, filename) || !verify_file(filename)) @@ -2339,8 +2339,8 @@ char* kdk_system_get_shortformat() { return NULL; } - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time) @@ -2414,8 +2414,8 @@ char* kdk_system_longformat_transform(struct tm *ptr) return NULL; } char tmp[128] = "\0"; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *lang = getenv("LANG"); homeDir = getenv("HOME"); @@ -2498,8 +2498,8 @@ char* kdk_system_shortformat_transform(struct tm *ptr) char value[32] = "\0"; char *tvalue = (char *)malloc(sizeof(char) * 64); char tmp[64]; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; struct tm stPrt; char *env_time = getenv("LC_TIME"); @@ -2761,8 +2761,8 @@ kdk_timeinfo *kdk_system_timeformat_transform(struct tm *ptr) // char tmp[64]; char tmpe[128] = "\0"; char stmp[128] = "\0"; - char canonical_filename[PATH_MAX] = "\0"; - char filename[PATH_MAX] = "\0"; + char canonical_filename[PATH_MAX_H] = "\0"; + char filename[PATH_MAX_H] = "\0"; char *env_time = getenv("LC_TIME"); if(!env_time)