Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
lektor
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Kubat
lektor
Validations
87e9caad
Vérifiée
Valider
87e9caad
rédigé
14 déc. 2022
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
FIX: Do the check for the creation of the default config file the right way
parent
5c4bc31f
Branches
Branches contenant la validation
Étiquettes
Étiquettes contenant la validation
Aucune requête de fusion associée trouvée
Pipeline
#3377
en échec
14 déc. 2022
Étape : build
Modifications
1
Pipelines
1
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
src/base/config.c
+5
-5
5 ajouts, 5 suppressions
src/base/config.c
avec
5 ajouts
et
5 suppressions
src/base/config.c
+
5
−
5
Voir le fichier @
87e9caad
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
/* Get the path to the config file that may be red, taking into account the
/* Get the path to the config file that may be red, taking into account the
priority between existing files. The returned path is a path to an existing
priority between existing files. The returned path is a path to an existing
file. If no file is found, returns a non zero value. Returns
1
otherwise. */
file. If no file is found, returns a non zero value. Returns
0
otherwise. */
PRIVATE_FUNCTION
int
config_detect_file
(
char
*
conf
,
size_t
conf_len
);
PRIVATE_FUNCTION
int
config_detect_file
(
char
*
conf
,
size_t
conf_len
);
/* Create and read the configuration in the conf file and write it into
/* Create and read the configuration in the conf file and write it into
...
@@ -342,9 +342,9 @@ ___mkdir(const char *dir)
...
@@ -342,9 +342,9 @@ ___mkdir(const char *dir)
int
int
config_open
(
lkt_db
*
db
,
char
*
conf_file
,
size_t
conf_len
)
config_open
(
lkt_db
*
db
,
char
*
conf_file
,
size_t
conf_len
)
{
{
int
retry_config_once
=
0
;
bool
retry_config_once
=
false
;
retry_config:
retry_config:
if
(
conf_file
[
0
]
==
'\0'
&&
config_detect_file
(
conf_file
,
conf_len
))
{
if
(
(
conf_file
[
0
]
==
'\0'
)
&&
config_detect_file
(
conf_file
,
conf_len
))
{
RETURN_IF
(
retry_config_once
,
"Failed to find a config file"
,
1
);
RETURN_IF
(
retry_config_once
,
"Failed to find a config file"
,
1
);
LOG_INFO
(
"INIT"
,
"Creating default config file"
);
LOG_INFO
(
"INIT"
,
"Creating default config file"
);
...
@@ -353,7 +353,7 @@ retry_config:
...
@@ -353,7 +353,7 @@ retry_config:
errno
=
0
;
errno
=
0
;
FILE
*
file_desc
=
fopen
(
conf_file
,
"w+"
);
FILE
*
file_desc
=
fopen
(
conf_file
,
"w+"
);
if
(
file_desc
!
=
NULL
)
{
if
(
file_desc
=
=
NULL
)
{
LOG_ERROR
(
"INIT"
,
"Failed to open default config file and initialize it"
);
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
,
LOG_ERROR
(
"INTI"
,
"Conf file is %s, errno is %d: %s"
,
conf_file
,
errno
,
strerror
(
errno
));
strerror
(
errno
));
...
@@ -363,7 +363,7 @@ retry_config:
...
@@ -363,7 +363,7 @@ retry_config:
fclose
(
file_desc
);
fclose
(
file_desc
);
LOG_INFO
(
"INIT"
,
"Default configuration file has been writen to %s"
,
conf_file
);
LOG_INFO
(
"INIT"
,
"Default configuration file has been writen to %s"
,
conf_file
);
retry_config_once
=
1
;
retry_config_once
=
true
;
goto
retry_config
;
goto
retry_config
;
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter