Skip to content
Extraits de code Groupes Projets

Comparer les révisions

Les modifications sont affichées comme si la révision source était fusionnée avec la révision cible. En savoir plus sur la comparaison des révisions.

Source

Sélectionner le projet cible
No results found

Cible

Sélectionner le projet cible
  • martin2018/lektor
1 résultat
Afficher les modifications
......@@ -14,6 +14,7 @@
- Add: the regex used to populate the database from disk is now modifiable from the config file, the keys are `database/{types,categories,languages}`. Those fields must only contain alpha characters and commas
- Add: re-use more informations from databases when upgrading the database because minimal version where added to the different fields in the table descriptions
- Add: new field `repo_timestamp` which is the timestamp of the kara from the repo. This field is defaulted to the `cached_mtime` at upgrade time if needed
- Fix: Correctly reading the `XDG_CONFIG_HOME` variable if present in the env...
- Fix: fix incorrect parsing of lists of commands with multiple arguments: the parser could overrun the correct command buffer and insert a '\0' between the next command and its furst argument
- Fix: fix issue #100 -> the `database_queue_add_id` won't add ids that doesn't exist
- Fix: be explicit about truncated commands, when a command is truncated, all the bytes after the end of the new string and before the end of the old string are not set to '\0' for safety
......
......@@ -199,16 +199,20 @@ config_default_file(char *dest, size_t len)
/* First try the XDG_CONFIG_HOME variable, else the default location HOME/.config. */
memset(dest, 0, len * sizeof(char));
char *home = getenv("XDG_CONFIG_HOME");
if (NULL == home || strlen(home) >= len) {
LOG_DEBUG("CONFIG", "No env variable XDG_CONFIG_HOME");
if ((NULL == home) || (strlen(home) >= len)) {
LOG_DEBUG("CONFIG", "No env variable XDG_CONFIG_HOME, try to use HOME");
home = getenv("HOME");
if (NULL == home)
if ((NULL == home) || (strlen(home) >= len)) {
LOG_FATAL("Failed to get home folder for user, will now exit");
safe_strncpy(dest, home, len);
strncat(dest, "/.config/lektor/lektor.ini", len - 1);
LOG_DEBUG("CONFIG", "Use '%s' insted of XDG_CONFIG_HOME", home);
} else
}
LOG_DEBUG("CONFIG", "Using HOME: %s", home);
safe_strncpy(dest, home, len - 1);
strncat(dest, "/.config/lektor/lektor.ini", len - 1 - strlen(home));
} else {
LOG_DEBUG("CONFIG", "Using XDG_CONFIG_HOME: %s", home);
safe_strncpy(dest, home, len - 1);
strncat(dest, "/lektor/lektor.ini", len - 1);
}
}
PRIVATE_FUNCTION int
......@@ -347,11 +351,12 @@ retry_config:
config_default_file(conf_file, conf_len);
___mkdir(conf_file); /* Create the folder for the file. */
errno = 0;
errno = 0;
FILE *file_desc = fopen(conf_file, "w+");
if (file_desc != NULL) {
LOG_ERROR("INIT", "Failed to open default config file and initialize it");
LOG_ERROR("INTI", "Conf file is %s, errno is %d: %s", conf_file, errno, strerror(errno));
LOG_ERROR("INTI", "Conf file is %s, errno is %d: %s", conf_file, errno,
strerror(errno));
return 1;
}
config_default(file_desc);
......
......@@ -459,8 +459,11 @@ rescan_or_update__(struct cmd_args *args, const char *cmd)
exit(EXIT_SUCCESS);
}
#define ___just_send_with_password(func, cmd) \
PRIVATE_FUNCTION EXIT_FUNCTION func(struct cmd_args *args) { rescan_or_update__(args, cmd); } \
#define ___just_send_with_password(func, cmd) \
PRIVATE_FUNCTION EXIT_FUNCTION func(struct cmd_args *args) \
{ \
rescan_or_update__(args, cmd); \
} \
// clang-format off
___just_send_with_password(rescan__, "rescan");
___just_send_with_password(update__, "update");
......@@ -1207,7 +1210,10 @@ redo:
}
#define search_with_cmd(func, cmd) /* I don't want to write always the same things */ \
PRIVATE_FUNCTION EXIT_FUNCTION func(struct cmd_args *args) { search_with_cmd__(args, #cmd); }
PRIVATE_FUNCTION EXIT_FUNCTION func(struct cmd_args *args) \
{ \
search_with_cmd__(args, #cmd); \
}
// clang-format off
search_with_cmd(search_db__, search);
search_with_cmd(search_count__, count);
......