fix: prevent multi-threaded server race conditions

This commit is contained in:
ngn 2024-08-16 00:22:44 +03:00
parent 9f0665ce64
commit 7b1bee0b99
4 changed files with 206 additions and 193 deletions

View File

@ -162,6 +162,7 @@ typedef struct lm_error_desc {
void lm_error_set(lm_error_t code, ...); void lm_error_set(lm_error_t code, ...);
void lm_error_clear(); void lm_error_clear();
void lm_error_init();
lm_error_t lm_error(); lm_error_t lm_error();
char *lm_strerror(); char *lm_strerror();

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-08-15 23:43+0300\n" "POT-Creation-Date: 2024-08-16 00:21+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -17,647 +17,647 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: src/error.c:19 #: src/error.c:31
msgid "no error" msgid "no error"
msgstr "hata yok" msgstr "hata yok"
#: src/error.c:20 #: src/error.c:32
#, fuzzy #, fuzzy
msgid "URL contains an invalid character" msgid "URL contains an invalid character"
msgstr "URL contains an invalid char" msgstr "URL contains an invalid char"
#: src/error.c:21 #: src/error.c:33
msgid "URL does not have a valid protocol field" msgid "URL does not have a valid protocol field"
msgstr "URL does not have a valid protocol field" msgstr "URL does not have a valid protocol field"
#: src/error.c:22 #: src/error.c:34
msgid "URL is too large" msgid "URL is too large"
msgstr "URL is too large" msgstr "URL is too large"
#: src/error.c:23 #: src/error.c:35
msgid "URL hostname is too large" msgid "URL hostname is too large"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:24 #: src/error.c:36
msgid "URL path is too large" msgid "URL path is too large"
msgstr "URL path is too large" msgstr "URL path is too large"
#: src/error.c:25 #: src/error.c:37
msgid "URL does not have a valid hostname" msgid "URL does not have a valid hostname"
msgstr "URL does not have a valid hostname" msgstr "URL does not have a valid hostname"
#: src/error.c:26 #: src/error.c:38
#, fuzzy #, fuzzy
msgid "URL does not have a valid port number" msgid "URL does not have a valid port number"
msgstr "URL does not have a valid hostname" msgstr "URL does not have a valid hostname"
#: src/error.c:27 #: src/error.c:39
msgid "URL does not have a valid path" msgid "URL does not have a valid path"
msgstr "URL does not have a valid path" msgstr "URL does not have a valid path"
#: src/error.c:28 #: src/error.c:40
#, fuzzy #, fuzzy
msgid "hostname does not contain a valid port number" msgid "hostname does not contain a valid port number"
msgstr "URL does not contain a hostname with a valid port number" msgstr "URL does not contain a hostname with a valid port number"
#: src/error.c:29 #: src/error.c:41
#, fuzzy #, fuzzy
msgid "hostname is not valid" msgid "hostname is not valid"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:30 #: src/error.c:42
msgid "URL protocol port number is unknown" msgid "URL protocol port number is unknown"
msgstr "URL protocol port number is unknown" msgstr "URL protocol port number is unknown"
#: src/error.c:31 #: src/error.c:43
msgid "URL is incomplete" msgid "URL is incomplete"
msgstr "URL tamamlanmamış" msgstr "URL tamamlanmamış"
#: src/error.c:32 #: src/error.c:44
msgid "pool does not support the specified protocol" msgid "pool does not support the specified protocol"
msgstr "pool does not support the specified protocol" msgstr "pool does not support the specified protocol"
#: src/error.c:33 #: src/error.c:45
msgid "unsupported MPTP version" msgid "unsupported MPTP version"
msgstr "" msgstr ""
#: src/error.c:34 #: src/error.c:46
msgid "invalid MPTP request/response code" msgid "invalid MPTP request/response code"
msgstr "" msgstr ""
#: src/error.c:35 #: src/error.c:47
msgid "invalid MPTP URL" msgid "invalid MPTP URL"
msgstr "" msgstr ""
#: src/error.c:36 #: src/error.c:48
msgid "failed to resolve hostname for MPTP connection" msgid "failed to resolve hostname for MPTP connection"
msgstr "" msgstr ""
#: src/error.c:37 #: src/error.c:49
msgid "failed to create a MPTP socket" msgid "failed to create a MPTP socket"
msgstr "" msgstr ""
#: src/error.c:38 #: src/error.c:50
msgid "failed to connect to the MPTP host" msgid "failed to connect to the MPTP host"
msgstr "" msgstr ""
#: src/error.c:39 #: src/error.c:51
#, c-format #, c-format
msgid "failed receive MPTP data from host: %s" msgid "failed receive MPTP data from host: %s"
msgstr "" msgstr ""
#: src/error.c:40 #: src/error.c:52
msgid "failed send MPTP data to host" msgid "failed send MPTP data to host"
msgstr "" msgstr ""
#: src/error.c:41 #: src/error.c:53
#, fuzzy #, fuzzy
msgid "MPTP data size is invalid" msgid "MPTP data size is invalid"
msgstr "URL path is too large" msgstr "URL path is too large"
#: src/error.c:42 #: src/error.c:54
#, fuzzy #, fuzzy
msgid "MPTP host size is invalid" msgid "MPTP host size is invalid"
msgstr "URL path is too large" msgstr "URL path is too large"
#: src/error.c:43 #: src/error.c:55
#, fuzzy #, fuzzy
msgid "MPTP path size is invalid" msgid "MPTP path size is invalid"
msgstr "URL path is too large" msgstr "URL path is too large"
#: src/error.c:44 #: src/error.c:56
msgid "failed to set MPTP socket options" msgid "failed to set MPTP socket options"
msgstr "" msgstr ""
#: src/error.c:45 #: src/error.c:57
msgid "MPTP connection timed out" msgid "MPTP connection timed out"
msgstr "" msgstr ""
#: src/error.c:46 #: src/error.c:58
#, c-format #, c-format
msgid "failed to bind MPTP socket: %s" msgid "failed to bind MPTP socket: %s"
msgstr "" msgstr ""
#: src/error.c:47 #: src/error.c:59
msgid "required argument is a NULL pointer or 0" msgid "required argument is a NULL pointer or 0"
msgstr "" msgstr ""
#: src/error.c:48 #: src/error.c:60
msgid "not a MPTP request" msgid "not a MPTP request"
msgstr "" msgstr ""
#: src/error.c:49 #: src/error.c:61
msgid "not a MPTP response" msgid "not a MPTP response"
msgstr "" msgstr ""
#: src/error.c:50 src/error.c:51 #: src/error.c:62 src/error.c:63
msgid "MPTP request last flag is not set" msgid "MPTP request last flag is not set"
msgstr "" msgstr ""
#: src/error.c:52 #: src/error.c:64
msgid "host port not specified" msgid "host port not specified"
msgstr "" msgstr ""
#: src/error.c:53 #: src/error.c:65
msgid "pool info is badly formatted or is not complete" msgid "pool info is badly formatted or is not complete"
msgstr "" msgstr ""
#: src/error.c:54 #: src/error.c:66
msgid "failed to write block from archive" msgid "failed to write block from archive"
msgstr "" msgstr ""
#: src/error.c:55 #: src/error.c:67
msgid "failed to read block from archive" msgid "failed to read block from archive"
msgstr "" msgstr ""
#: src/error.c:56 #: src/error.c:68
msgid "failed to open archive" msgid "failed to open archive"
msgstr "" msgstr ""
#: src/error.c:57 #: src/error.c:69
msgid "failed to write archive header" msgid "failed to write archive header"
msgstr "" msgstr ""
#: src/error.c:58 #: src/error.c:70
msgid "failed to finish writing the archive entry" msgid "failed to finish writing the archive entry"
msgstr "" msgstr ""
#: src/error.c:59 #: src/error.c:71
msgid "failed to create new archive reader/writer" msgid "failed to create new archive reader/writer"
msgstr "" msgstr ""
#: src/error.c:60 #: src/error.c:72
msgid "failed to resolve full path for archive file" msgid "failed to resolve full path for archive file"
msgstr "" msgstr ""
#: src/error.c:61 #: src/error.c:73
msgid "failed to read the next header of the archive" msgid "failed to read the next header of the archive"
msgstr "" msgstr ""
#: src/error.c:62 #: src/error.c:74
msgid "failed to obtain current working directory" msgid "failed to obtain current working directory"
msgstr "" msgstr ""
#: src/error.c:63 #: src/error.c:75
msgid "failed to open extracted pool list directory" msgid "failed to open extracted pool list directory"
msgstr "" msgstr ""
#: src/error.c:64 #: src/error.c:76
msgid "failed to read access the pool list file" msgid "failed to read access the pool list file"
msgstr "" msgstr ""
#: src/error.c:65 #: src/error.c:77
msgid "failed to read access the pool info file" msgid "failed to read access the pool info file"
msgstr "" msgstr ""
#: src/error.c:66 #: src/error.c:78
msgid "failed to parse package data" msgid "failed to parse package data"
msgstr "" msgstr ""
#: src/error.c:67 #: src/error.c:79
#, fuzzy #, fuzzy
msgid "package name is invalid" msgid "package name is invalid"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:68 #: src/error.c:80
msgid "data path is not set with in the ctx" msgid "data path is not set with in the ctx"
msgstr "" msgstr ""
#: src/error.c:69 #: src/error.c:81
msgid "temp path is not set with in the ctx" msgid "temp path is not set with in the ctx"
msgstr "" msgstr ""
#: src/error.c:70 #: src/error.c:82
msgid "root path is not set with in the ctx" msgid "root path is not set with in the ctx"
msgstr "" msgstr ""
#: src/error.c:71 #: src/error.c:83
#, c-format #, c-format
msgid "failed to set the ctx temp director to %s: %s" msgid "failed to set the ctx temp director to %s: %s"
msgstr "" msgstr ""
#: src/error.c:72 #: src/error.c:84
#, c-format #, c-format
msgid "failed to set the ctx root directory to %s: %s" msgid "failed to set the ctx root directory to %s: %s"
msgstr "" msgstr ""
#: src/error.c:73 #: src/error.c:85
#, c-format #, c-format
msgid "failed to set the ctx data directory to %s: %s" msgid "failed to set the ctx data directory to %s: %s"
msgstr "" msgstr ""
#: src/error.c:74 #: src/error.c:86
msgid "pool did not respond ping with pong" msgid "pool did not respond ping with pong"
msgstr "" msgstr ""
#: src/error.c:75 #: src/error.c:87
msgid "package file and directory paths are empty" msgid "package file and directory paths are empty"
msgstr "" msgstr ""
#: src/error.c:76 #: src/error.c:88
msgid "failed to to open target file for sending" msgid "failed to to open target file for sending"
msgstr "" msgstr ""
#: src/error.c:77 #: src/error.c:89
msgid "failed to to delete target file for receiving" msgid "failed to to delete target file for receiving"
msgstr "" msgstr ""
#: src/error.c:78 #: src/error.c:90
msgid "failed to to open target file for receiving" msgid "failed to to open target file for receiving"
msgstr "" msgstr ""
#: src/error.c:79 #: src/error.c:91
msgid "got a bad response code for receiving the target file" msgid "got a bad response code for receiving the target file"
msgstr "" msgstr ""
#: src/error.c:80 #: src/error.c:92
msgid "failed to write to the target file for receiving" msgid "failed to write to the target file for receiving"
msgstr "" msgstr ""
#: src/error.c:81 #: src/error.c:93
#, fuzzy #, fuzzy
msgid "package not found" msgid "package not found"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:82 #: src/error.c:94
msgid "failed to access to the database file/directory" msgid "failed to access to the database file/directory"
msgstr "" msgstr ""
#: src/error.c:83 #: src/error.c:95
msgid "failed to open SQLite database" msgid "failed to open SQLite database"
msgstr "" msgstr ""
#: src/error.c:84 #: src/error.c:96
msgid "failed to create table in SQLite database" msgid "failed to create table in SQLite database"
msgstr "" msgstr ""
#: src/error.c:85 #: src/error.c:97
msgid "failed to prepare statement for SQLite database" msgid "failed to prepare statement for SQLite database"
msgstr "" msgstr ""
#: src/error.c:86 #: src/error.c:98
msgid "failed to insert to the table in SQLite database" msgid "failed to insert to the table in SQLite database"
msgstr "" msgstr ""
#: src/error.c:87 #: src/error.c:99
msgid "failed to select from the table in SQLite database" msgid "failed to select from the table in SQLite database"
msgstr "" msgstr ""
#: src/error.c:88 #: src/error.c:100
msgid "failed to delete from the table in SQLite database" msgid "failed to delete from the table in SQLite database"
msgstr "" msgstr ""
#: src/error.c:89 #: src/error.c:101
msgid "failed to find entry in SQLite database" msgid "failed to find entry in SQLite database"
msgstr "" msgstr ""
#: src/error.c:90 #: src/error.c:102
msgid "failed to init GPG for package verification" msgid "failed to init GPG for package verification"
msgstr "" msgstr ""
#: src/error.c:91 #: src/error.c:103
msgid "failed to import signature to GPG for package verification" msgid "failed to import signature to GPG for package verification"
msgstr "" msgstr ""
#: src/error.c:92 #: src/error.c:104
msgid "failed to import archive to GPG for package verification" msgid "failed to import archive to GPG for package verification"
msgstr "" msgstr ""
#: src/error.c:93 #: src/error.c:105
msgid "package signature verification failed with zero matches" msgid "package signature verification failed with zero matches"
msgstr "" msgstr ""
#: src/error.c:94 #: src/error.c:106
msgid "package signature verification failed with zero results" msgid "package signature verification failed with zero results"
msgstr "" msgstr ""
#: src/error.c:95 #: src/error.c:107
msgid "pool file and directory paths are empty" msgid "pool file and directory paths are empty"
msgstr "" msgstr ""
#: src/error.c:96 #: src/error.c:108
msgid "pool is not avaliable for connection" msgid "pool is not avaliable for connection"
msgstr "" msgstr ""
#: src/error.c:97 #: src/error.c:109
msgid "pool URL is empty or invalid" msgid "pool URL is empty or invalid"
msgstr "" msgstr ""
#: src/error.c:98 #: src/error.c:110
msgid "pool directory path is not accessible" msgid "pool directory path is not accessible"
msgstr "" msgstr ""
#: src/error.c:99 #: src/error.c:111
msgid "pool directory sub-paths are not accessible" msgid "pool directory sub-paths are not accessible"
msgstr "" msgstr ""
#: src/error.c:100 #: src/error.c:112
msgid "file list not found for the package" msgid "file list not found for the package"
msgstr "" msgstr ""
#: src/error.c:101 #: src/error.c:113
#, c-format #, c-format
msgid "failed to rename the file list for the package: %s" msgid "failed to rename the file list for the package: %s"
msgstr "" msgstr ""
#: src/error.c:102 #: src/error.c:114
#, c-format #, c-format
msgid "failed to open the package file list: %s" msgid "failed to open the package file list: %s"
msgstr "" msgstr ""
#: src/error.c:103 #: src/error.c:115
#, c-format #, c-format
msgid "failed to open the database directory: %s" msgid "failed to open the database directory: %s"
msgstr "" msgstr ""
#: src/error.c:104 #: src/error.c:116
#, c-format #, c-format
msgid "failed to remove package file list: %s" msgid "failed to remove package file list: %s"
msgstr "" msgstr ""
#: src/error.c:105 #: src/error.c:117
msgid "package keep list not found in the database" msgid "package keep list not found in the database"
msgstr "" msgstr ""
#: src/error.c:106 #: src/error.c:118
msgid "failed to open package keep list in the database" msgid "failed to open package keep list in the database"
msgstr "" msgstr ""
#: src/error.c:107 #: src/error.c:119
msgid "failed to access package keep list database directory" msgid "failed to access package keep list database directory"
msgstr "" msgstr ""
#: src/error.c:108 #: src/error.c:120
msgid "failed to remove package keep list from the database" msgid "failed to remove package keep list from the database"
msgstr "" msgstr ""
#: src/error.c:109 #: src/error.c:121
#, c-format #, c-format
msgid "failed to find %s (dependency of %s)" msgid "failed to find %s (dependency of %s)"
msgstr "" msgstr ""
#: src/error.c:110 #: src/error.c:122
#, c-format #, c-format
msgid "failed to download %s for installation: %s" msgid "failed to download %s for installation: %s"
msgstr "" msgstr ""
#: src/error.c:111 #: src/error.c:123
#, fuzzy #, fuzzy
msgid "package is not downloaded" msgid "package is not downloaded"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:112 src/error.c:113 #: src/error.c:124 src/error.c:125
msgid "failed to remove downloaded package" msgid "failed to remove downloaded package"
msgstr "" msgstr ""
#: src/error.c:114 #: src/error.c:126
msgid "failed to open the destination file" msgid "failed to open the destination file"
msgstr "" msgstr ""
#: src/error.c:115 #: src/error.c:127
msgid "failed to open the source file" msgid "failed to open the source file"
msgstr "" msgstr ""
#: src/error.c:116 src/error.c:117 #: src/error.c:128 src/error.c:129
msgid "failed to write to the destination file" msgid "failed to write to the destination file"
msgstr "" msgstr ""
#: src/error.c:118 #: src/error.c:130
msgid "package does not have associated pool" msgid "package does not have associated pool"
msgstr "" msgstr ""
#: src/error.c:119 #: src/error.c:131
msgid "failed to create specified temp directory" msgid "failed to create specified temp directory"
msgstr "" msgstr ""
#: src/error.c:120 #: src/error.c:132
msgid "package archive does not contain required files" msgid "package archive does not contain required files"
msgstr "" msgstr ""
#: src/error.c:121 #: src/error.c:133
msgid "package data does not match with target package" msgid "package data does not match with target package"
msgstr "" msgstr ""
#: src/error.c:122 #: src/error.c:134
#, c-format #, c-format
msgid "failed to update changes file for package: %s" msgid "failed to update changes file for package: %s"
msgstr "" msgstr ""
#: src/error.c:123 #: src/error.c:135
msgid "failed to access package hashes file" msgid "failed to access package hashes file"
msgstr "" msgstr ""
#: src/error.c:124 #: src/error.c:136
msgid "failed to remove package changes file from the database" msgid "failed to remove package changes file from the database"
msgstr "" msgstr ""
#: src/error.c:125 #: src/error.c:137
msgid "failed to stat target file for sending" msgid "failed to stat target file for sending"
msgstr "" msgstr ""
#: src/error.c:126 #: src/error.c:138
msgid "failed to format target file size for sending" msgid "failed to format target file size for sending"
msgstr "" msgstr ""
#: src/error.c:127 #: src/error.c:139
msgid "failed to read target file size for sending" msgid "failed to read target file size for sending"
msgstr "" msgstr ""
#: src/error.c:128 #: src/error.c:140
msgid "failed to parse target file size for receiving" msgid "failed to parse target file size for receiving"
msgstr "" msgstr ""
#: src/error.c:129 #: src/error.c:141
msgid "target file is not fully received" msgid "target file is not fully received"
msgstr "" msgstr ""
#: src/error.c:130 #: src/error.c:142
msgid "failed to stat for target extract archive" msgid "failed to stat for target extract archive"
msgstr "" msgstr ""
#: src/error.c:131 #: src/error.c:143
#, c-format #, c-format
msgid "failed to add package file (%s) to the database: %s" msgid "failed to add package file (%s) to the database: %s"
msgstr "" msgstr ""
#: src/error.c:132 #: src/error.c:144
#, c-format #, c-format
msgid "failed to extract package files: %s" msgid "failed to extract package files: %s"
msgstr "" msgstr ""
#: src/error.c:133 #: src/error.c:145
#, c-format #, c-format
msgid "failed to add package to the database: %s" msgid "failed to add package to the database: %s"
msgstr "" msgstr ""
#: src/error.c:134 #: src/error.c:146
#, fuzzy #, fuzzy
msgid "package is already installed" msgid "package is already installed"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:135 #: src/error.c:147
#, fuzzy #, fuzzy
msgid "package is not installed" msgid "package is not installed"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:136 #: src/error.c:148
#, c-format #, c-format
msgid "failed to remove package file (%s): %s" msgid "failed to remove package file (%s): %s"
msgstr "" msgstr ""
#: src/error.c:137 #: src/error.c:149
#, c-format #, c-format
msgid "failed to remove package from the database: %s" msgid "failed to remove package from the database: %s"
msgstr "" msgstr ""
#: src/error.c:138 #: src/error.c:150
#, c-format #, c-format
msgid "failed to remove package files from the database: %s" msgid "failed to remove package files from the database: %s"
msgstr "" msgstr ""
#: src/error.c:139 #: src/error.c:151
#, c-format #, c-format
msgid "failed to remove changes file for package: %s" msgid "failed to remove changes file for package: %s"
msgstr "" msgstr ""
#: src/error.c:140 #: src/error.c:152
msgid "failed to get current directory for running install" msgid "failed to get current directory for running install"
msgstr "" msgstr ""
#: src/error.c:141 #: src/error.c:153
msgid "failed change directory to root for running install" msgid "failed change directory to root for running install"
msgstr "" msgstr ""
#: src/error.c:142 #: src/error.c:154
msgid "failed run install spawn command" msgid "failed run install spawn command"
msgstr "" msgstr ""
#: src/error.c:144 #: src/error.c:156
msgid "failed to change directory to old directory after running install" msgid "failed to change directory to old directory after running install"
msgstr "" msgstr ""
#: src/error.c:145 #: src/error.c:157
msgid "install script returned a bad status code" msgid "install script returned a bad status code"
msgstr "" msgstr ""
#: src/error.c:146 #: src/error.c:158
#, c-format #, c-format
msgid "failed to run the package install script: %s" msgid "failed to run the package install script: %s"
msgstr "" msgstr ""
#: src/error.c:147 #: src/error.c:159
#, c-format #, c-format
msgid "failed to save the package install script: %s" msgid "failed to save the package install script: %s"
msgstr "" msgstr ""
#: src/error.c:148 #: src/error.c:160
#, c-format #, c-format
msgid "removing package breaks %s" msgid "removing package breaks %s"
msgstr "" msgstr ""
#: src/error.c:149 #: src/error.c:161
#, fuzzy #, fuzzy
msgid "package is already up-to-date" msgid "package is already up-to-date"
msgstr "URL hostname is too large" msgstr "URL hostname is too large"
#: src/error.c:150 #: src/error.c:162
msgid "failed to open file for hashing" msgid "failed to open file for hashing"
msgstr "" msgstr ""
#: src/error.c:151
msgid "failed create digest for hashing"
msgstr ""
#: src/error.c:152
#, c-format
msgid "failed to get hash of %s: %s"
msgstr ""
#: src/error.c:153
#, c-format
msgid "file hash does not match for %s"
msgstr ""
#: src/error.c:154
#, fuzzy
msgid "pool info is not loaded"
msgstr "URL hostname is too large"
#: src/error.c:155
msgid "pool list is empty"
msgstr ""
#: src/error.c:156
msgid "package changes file not found in the database"
msgstr ""
#: src/error.c:157
msgid "failed to change mod of the changes file"
msgstr ""
#: src/error.c:158
msgid "failed to create install script save directory"
msgstr ""
#: src/error.c:159
msgid "directory does not have write permissions"
msgstr ""
#: src/error.c:160
msgid "specified path is not a directory"
msgstr ""
#: src/error.c:161
msgid "failed to create the specified directory"
msgstr ""
#: src/error.c:162
msgid "specified list extraction directory is not accessible"
msgstr ""
#: src/error.c:163 #: src/error.c:163
#, c-format msgid "failed create digest for hashing"
msgid "file does not exist: %s"
msgstr "" msgstr ""
#: src/error.c:164 #: src/error.c:164
#, c-format #, c-format
msgid "file is a symbolic link: %s" msgid "failed to get hash of %s: %s"
msgstr "" msgstr ""
#: src/error.c:165 #: src/error.c:165
msgid "failed to set the package archive" #, c-format
msgid "file hash does not match for %s"
msgstr "" msgstr ""
#: src/error.c:166 #: src/error.c:166
#, fuzzy
msgid "pool info is not loaded"
msgstr "URL hostname is too large"
#: src/error.c:167
msgid "pool list is empty"
msgstr ""
#: src/error.c:168
msgid "package changes file not found in the database"
msgstr ""
#: src/error.c:169
msgid "failed to change mod of the changes file"
msgstr ""
#: src/error.c:170
msgid "failed to create install script save directory"
msgstr ""
#: src/error.c:171
msgid "directory does not have write permissions"
msgstr ""
#: src/error.c:172
msgid "specified path is not a directory"
msgstr ""
#: src/error.c:173
msgid "failed to create the specified directory"
msgstr ""
#: src/error.c:174
msgid "specified list extraction directory is not accessible"
msgstr ""
#: src/error.c:175
#, c-format
msgid "file does not exist: %s"
msgstr ""
#: src/error.c:176
#, c-format
msgid "file is a symbolic link: %s"
msgstr ""
#: src/error.c:177
msgid "failed to set the package archive"
msgstr ""
#: src/error.c:178
#, c-format #, c-format
msgid "failed change directory: %s" msgid "failed change directory: %s"
msgstr "" msgstr ""
#: src/error.c:167 #: src/error.c:179
msgid "failed to change directory to root during extraction" msgid "failed to change directory to root during extraction"
msgstr "" msgstr ""
#: src/error.c:168 #: src/error.c:180
msgid "failed to change directory back from root during extraction" msgid "failed to change directory back from root during extraction"
msgstr "" msgstr ""
#: src/error.c:169 #: src/error.c:181
#, c-format #, c-format
msgid "failed to accept the MPTP connection: %s" msgid "failed to accept the MPTP connection: %s"
msgstr "" msgstr ""
#: src/error.c:170 #: src/error.c:182
#, c-format #, c-format
msgid "failed to listen the MPTP socket: %s" msgid "failed to listen the MPTP socket: %s"
msgstr "" msgstr ""
#: src/error.c:171 #: src/error.c:183
#, c-format #, c-format
msgid "pool name (%s) doesn't match with: %s" msgid "pool name (%s) doesn't match with: %s"
msgstr "" msgstr ""
#: src/error.c:172 #: src/error.c:184
#, c-format #, c-format
msgid "unknown key in the configuration: %s" msgid "unknown key in the configuration: %s"
msgstr "" msgstr ""

View File

@ -40,7 +40,7 @@ bool lm_ctx_init(lm_ctx_t *ctx) {
bzero(ctx, sizeof(lm_ctx_t)); bzero(ctx, sizeof(lm_ctx_t));
ctx->version = LM_VERSION; ctx->version = LM_VERSION;
lm_error_clear(); lm_error_init();
return true; return true;
} }

View File

@ -1,12 +1,14 @@
#include "../include/error.h" #include "../include/error.h"
#include "../include/util.h" #include "../include/util.h"
#include <pthread.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
lm_error_t lm_error_code = LM_ERR_NoError; lm_error_t lm_error_code = LM_ERR_NoError; // error code
char *lm_error_str = NULL; char *lm_error_str = NULL; // error string
pthread_t lm_error_thread = 0; // thread that is using the error system
void lm_error_clear() { void lm_error_clear() {
free(lm_error_str); free(lm_error_str);
@ -14,7 +16,17 @@ void lm_error_clear() {
lm_error_str = NULL; lm_error_str = NULL;
} }
void lm_error_init() {
lm_error_clear();
lm_error_code = LM_ERR_NoError;
lm_error_str = NULL;
lm_error_thread = pthread_self();
}
void lm_error_set(lm_error_t code, ...) { void lm_error_set(lm_error_t code, ...) {
if (!pthread_equal(pthread_self(), lm_error_thread)) // ignore error_set outside the main thread
return;
lm_error_desc_t errors[] = { lm_error_desc_t errors[] = {
{.code = LM_ERR_NoError, .desc = _("no error") }, {.code = LM_ERR_NoError, .desc = _("no error") },
{.code = LM_ERR_URLBadChar, .desc = _("URL contains an invalid character") }, {.code = LM_ERR_URLBadChar, .desc = _("URL contains an invalid character") },