Blame


1 7b19e0f1 2017-11-05 stsp /*
2 5aa81393 2020-01-06 stsp * Copyright (c) 2018, 2019, 2020 Stefan Sperling <stsp@openbsd.org>
3 93658fb9 2020-03-18 stsp * Copyright (c) 2020 Ori Bernstein <ori@openbsd.org>
4 7b19e0f1 2017-11-05 stsp *
5 7b19e0f1 2017-11-05 stsp * Permission to use, copy, modify, and distribute this software for any
6 7b19e0f1 2017-11-05 stsp * purpose with or without fee is hereby granted, provided that the above
7 7b19e0f1 2017-11-05 stsp * copyright notice and this permission notice appear in all copies.
8 7b19e0f1 2017-11-05 stsp *
9 7b19e0f1 2017-11-05 stsp * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 7b19e0f1 2017-11-05 stsp * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 7b19e0f1 2017-11-05 stsp * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 7b19e0f1 2017-11-05 stsp * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 7b19e0f1 2017-11-05 stsp * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 7b19e0f1 2017-11-05 stsp * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 7b19e0f1 2017-11-05 stsp * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 7b19e0f1 2017-11-05 stsp */
17 4027f31a 2017-11-04 stsp
18 4027f31a 2017-11-04 stsp /* Error codes */
19 0a585a0d 2018-03-17 stsp #define GOT_ERR_OK 0
20 0a585a0d 2018-03-17 stsp #define GOT_ERR_ERRNO 1
21 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NOT_GIT_REPO 2
22 f7b97ccb 2020-04-14 stsp #define GOT_ERR_BAD_FILETYPE 3
23 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PATH 4
24 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NOT_REF 5
25 a1fd68d8 2018-01-12 stsp #define GOT_ERR_IO 6
26 a1fd68d8 2018-01-12 stsp #define GOT_ERR_EOF 7
27 a1fd68d8 2018-01-12 stsp #define GOT_ERR_DECOMPRESSION 8
28 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NO_SPACE 9
29 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_OBJ_HDR 10
30 a1fd68d8 2018-01-12 stsp #define GOT_ERR_OBJ_TYPE 11
31 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_OBJ_DATA 12
32 e09a504c 2019-06-28 stsp #define GOT_ERR_AMBIGUOUS_ID 13
33 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PACKIDX 14
34 a1fd68d8 2018-01-12 stsp #define GOT_ERR_PACKIDX_CSUM 15
35 a1fd68d8 2018-01-12 stsp #define GOT_ERR_BAD_PACKFILE 16
36 a1fd68d8 2018-01-12 stsp #define GOT_ERR_NO_OBJ 17
37 a487c1d0 2018-01-14 stsp #define GOT_ERR_NOT_IMPL 18
38 3ee5fc21 2018-01-17 stsp #define GOT_ERR_OBJ_NOT_PACKED 19
39 96f5e8b3 2018-01-23 stsp #define GOT_ERR_BAD_DELTA_CHAIN 20
40 885d3e02 2018-01-27 stsp #define GOT_ERR_BAD_DELTA 21
41 885d3e02 2018-01-27 stsp #define GOT_ERR_COMPRESSION 22
42 59ece79d 2018-02-12 stsp #define GOT_ERR_BAD_OBJ_ID_STR 23
43 86c3caaf 2018-03-09 stsp #define GOT_ERR_WORKTREE_EXISTS 26
44 09fe317a 2018-03-11 stsp #define GOT_ERR_WORKTREE_META 27
45 6d9d28c3 2018-03-11 stsp #define GOT_ERR_WORKTREE_VERS 28
46 6d9d28c3 2018-03-11 stsp #define GOT_ERR_WORKTREE_BUSY 29
47 9d31a1d8 2018-03-11 stsp #define GOT_ERR_DIR_OBSTRUCTED 30
48 9d31a1d8 2018-03-11 stsp #define GOT_ERR_FILE_OBSTRUCTED 31
49 5b7e13a7 2018-04-02 stsp #define GOT_ERR_RECURSION 32
50 2178c42e 2018-04-22 stsp #define GOT_ERR_TIMEOUT 33
51 2178c42e 2018-04-22 stsp #define GOT_ERR_INTERRUPT 34
52 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_READ 35
53 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_LEN 36
54 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_PIPE 37
55 2178c42e 2018-04-22 stsp #define GOT_ERR_PRIVSEP_NO_FD 38
56 8c580685 2018-04-22 stsp #define GOT_ERR_PRIVSEP_MSG 39
57 b419fc47 2018-04-26 stsp #define GOT_ERR_PRIVSEP_DIED 40
58 b419fc47 2018-04-26 stsp #define GOT_ERR_PRIVSEP_EXIT 41
59 0c048b15 2018-04-27 stsp #define GOT_ERR_PACK_OFFSET 42
60 54be8251 2018-06-04 stsp #define GOT_ERR_OBJ_EXISTS 43
61 54be8251 2018-06-04 stsp #define GOT_ERR_BAD_OBJ_ID 44
62 3d509237 2020-01-04 stsp #define GOT_ERR_ITER_BUSY 45
63 9ba79e04 2018-06-11 stsp #define GOT_ERR_ITER_COMPLETED 46
64 730c718b 2018-06-21 stsp #define GOT_ERR_RANGE 47
65 89817b30 2018-11-11 stsp #define GOT_ERR_EXPECTED 48 /* for use in regress tests only */
66 99437157 2018-11-11 stsp #define GOT_ERR_CANCELLED 49
67 d1451975 2018-11-11 stsp #define GOT_ERR_NO_TREE_ENTRY 50
68 52a74475 2018-12-24 stsp #define GOT_ERR_FILEIDX_SIG 51
69 52a74475 2018-12-24 stsp #define GOT_ERR_FILEIDX_VER 52
70 52a74475 2018-12-24 stsp #define GOT_ERR_FILEIDX_CSUM 53
71 49520a32 2018-12-29 stsp #define GOT_ERR_PATH_PREFIX 54
72 be7061eb 2018-12-30 stsp #define GOT_ERR_ANCESTRY 55
73 27793341 2019-01-12 stsp #define GOT_ERR_FILEIDX_BAD 56
74 a808cfa5 2019-02-03 stsp #define GOT_ERR_BAD_REF_DATA 57
75 f5d3d7af 2019-02-05 stsp #define GOT_ERR_TREE_DUP_ENTRY 58
76 f5d3d7af 2019-02-05 stsp #define GOT_ERR_DIR_DUP_ENTRY 59
77 247140b2 2019-02-05 stsp #define GOT_ERR_NOT_WORKTREE 60
78 09589288 2019-03-10 stsp #define GOT_ERR_UUID_VERSION 61
79 09589288 2019-03-10 stsp #define GOT_ERR_UUID_INVALID 62
80 09589288 2019-03-10 stsp #define GOT_ERR_UUID 63
81 01b7ba6b 2019-03-11 stsp #define GOT_ERR_LOCKFILE_TIMEOUT 64
82 f77a24b0 2019-03-11 stsp #define GOT_ERR_BAD_REF_NAME 65
83 0c48fee2 2019-03-11 stsp #define GOT_ERR_WORKTREE_REPO 66
84 2ec1f75b 2019-03-26 stsp #define GOT_ERR_FILE_MODIFIED 67
85 2ec1f75b 2019-03-26 stsp #define GOT_ERR_FILE_STATUS 68
86 c4296144 2019-05-09 stsp #define GOT_ERR_COMMIT_CONFLICT 69
87 b249b824 2019-05-09 stsp #define GOT_ERR_BAD_REF_TYPE 70
88 35bd8fed 2019-05-09 stsp #define GOT_ERR_COMMIT_NO_AUTHOR 71
89 09f5bd90 2019-05-09 stsp #define GOT_ERR_COMMIT_HEAD_CHANGED 72
90 819f385b 2019-05-10 stsp #define GOT_ERR_COMMIT_OUT_OF_DATE 73
91 33ad4cbe 2019-05-12 jcs #define GOT_ERR_COMMIT_MSG_EMPTY 74
92 33ad4cbe 2019-05-12 jcs #define GOT_ERR_DIR_NOT_EMPTY 75
93 33ad4cbe 2019-05-12 jcs #define GOT_ERR_COMMIT_NO_CHANGES 76
94 a367ff0f 2019-05-14 stsp #define GOT_ERR_BRANCH_MOVED 77
95 79c99a64 2019-05-23 stsp #define GOT_ERR_OBJ_TOO_LARGE 78
96 234035bc 2019-06-01 stsp #define GOT_ERR_SAME_BRANCH 79
97 5ef14e63 2019-06-02 stsp #define GOT_ERR_ROOT_COMMIT 80
98 234035bc 2019-06-01 stsp #define GOT_ERR_MIXED_COMMITS 81
99 234035bc 2019-06-01 stsp #define GOT_ERR_CONFLICTS 82
100 4e759de4 2019-06-26 stsp #define GOT_ERR_BRANCH_EXISTS 83
101 818c7501 2019-07-11 stsp #define GOT_ERR_MODIFIED 84
102 818c7501 2019-07-11 stsp #define GOT_ERR_NOT_REBASING 85
103 980c6786 2023-01-31 stsp /* 86 is currently unused */
104 818c7501 2019-07-11 stsp #define GOT_ERR_REBASE_COMMITID 87
105 7d5807f4 2019-07-11 stsp #define GOT_ERR_REBASING 88
106 64c6d990 2019-07-11 stsp #define GOT_ERR_REBASE_PATH 89
107 0ebf8283 2019-07-24 stsp #define GOT_ERR_NOT_HISTEDIT 90
108 0ebf8283 2019-07-24 stsp #define GOT_ERR_EMPTY_HISTEDIT 91
109 0ebf8283 2019-07-24 stsp #define GOT_ERR_NO_HISTEDIT_CMD 92
110 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_SYNTAX 93
111 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_CANCEL 94
112 de05890f 2020-03-05 stsp /* 95 is currently unused */
113 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_BUSY 96
114 0ebf8283 2019-07-24 stsp #define GOT_ERR_HISTEDIT_CMD 97
115 8ca9bd68 2019-07-25 stsp #define GOT_ERR_HISTEDIT_PATH 98
116 13b2bc37 2022-10-23 stsp #define GOT_ERR_PACKFILE_CSUM 99
117 916f288c 2019-07-30 stsp #define GOT_ERR_COMMIT_BRANCH 100
118 9acbc4fa 2019-08-03 stsp #define GOT_ERR_FILE_STAGED 101
119 d3e7c587 2019-08-03 stsp #define GOT_ERR_STAGE_NO_CHANGE 102
120 ebf48fd5 2019-08-03 stsp #define GOT_ERR_STAGE_CONFLICT 103
121 735ef5ac 2019-08-03 stsp #define GOT_ERR_STAGE_OUT_OF_DATE 104
122 f0b75401 2019-08-03 stsp #define GOT_ERR_FILE_NOT_STAGED 105
123 f032f1f7 2019-08-04 stsp #define GOT_ERR_STAGED_PATHS 106
124 dc424a06 2019-08-07 stsp #define GOT_ERR_PATCH_CHOICE 107
125 84792843 2019-08-09 stsp #define GOT_ERR_COMMIT_NO_EMAIL 108
126 8e7bd50a 2019-08-22 stsp #define GOT_ERR_TAG_EXISTS 109
127 aba9c984 2019-09-08 stsp #define GOT_ERR_GIT_REPO_FORMAT 110
128 2822a352 2019-10-15 stsp #define GOT_ERR_REBASE_REQUIRED 111
129 6d17833f 2019-11-08 stsp #define GOT_ERR_REGEX 112
130 bd5895f3 2019-11-28 stsp #define GOT_ERR_REF_NAME_MINUS 113
131 cd95becd 2019-11-29 stsp #define GOT_ERR_GITCONFIG_SYNTAX 114
132 abd4a1be 2020-03-18 stsp #define GOT_ERR_REBASE_OUT_OF_DATE 115
133 abd4a1be 2020-03-18 stsp #define GOT_ERR_CACHE_DUP_ENTRY 116
134 abd4a1be 2020-03-18 stsp #define GOT_ERR_QUERYSTRING 117
135 abd4a1be 2020-03-18 stsp #define GOT_ERR_FETCH_FAILED 118
136 abd4a1be 2020-03-18 stsp #define GOT_ERR_PARSE_URI 119
137 abd4a1be 2020-03-18 stsp #define GOT_ERR_BAD_PROTO 120
138 5cc27ede 2020-03-18 stsp #define GOT_ERR_ADDRINFO 121
139 fe53745c 2020-03-18 stsp #define GOT_ERR_BAD_PACKET 122
140 7848a0e1 2020-03-19 stsp #define GOT_ERR_NO_REMOTE 123
141 659e7fbd 2020-03-20 stsp #define GOT_ERR_FETCH_NO_BRANCH 124
142 0e4002ca 2020-03-21 stsp #define GOT_ERR_FETCH_BAD_REF 125
143 0d6c6ee3 2020-05-20 stsp #define GOT_ERR_TREE_ENTRY_TYPE 126
144 257add31 2020-09-09 stsp #define GOT_ERR_PARSE_CONFIG 127
145 fb863fa4 2020-06-22 tracey #define GOT_ERR_NO_CONFIG_FILE 128
146 35213c7c 2020-07-23 stsp #define GOT_ERR_BAD_SYMLINK 129
147 20b7abb3 2020-10-22 stsp #define GOT_ERR_GIT_REPO_EXT 130
148 05118f5a 2021-06-22 stsp #define GOT_ERR_CANNOT_PACK 131
149 1124fe40 2021-07-07 stsp #define GOT_ERR_LONELY_PACKIDX 132
150 d5c81d44 2021-07-08 stsp #define GOT_ERR_OBJ_CSUM 133
151 f8a36e22 2021-08-26 stsp #define GOT_ERR_SEND_BAD_REF 134
152 f8a36e22 2021-08-26 stsp #define GOT_ERR_SEND_FAILED 135
153 f8a36e22 2021-08-26 stsp #define GOT_ERR_SEND_EMPTY 136
154 f8a36e22 2021-08-26 stsp #define GOT_ERR_SEND_ANCESTRY 137
155 f8a36e22 2021-08-26 stsp #define GOT_ERR_CAPA_DELETE_REFS 138
156 f8a36e22 2021-08-26 stsp #define GOT_ERR_SEND_DELETE_REF 139
157 f8a36e22 2021-08-26 stsp #define GOT_ERR_SEND_TAG_EXISTS 140
158 f259c4c1 2021-09-24 stsp #define GOT_ERR_NOT_MERGING 141
159 f259c4c1 2021-09-24 stsp #define GOT_ERR_MERGE_OUT_OF_DATE 142
160 f259c4c1 2021-09-24 stsp #define GOT_ERR_MERGE_STAGED_PATHS 143
161 f259c4c1 2021-09-24 stsp #define GOT_ERR_MERGE_BUSY 144
162 f259c4c1 2021-09-24 stsp #define GOT_ERR_MERGE_PATH 145
163 0e039681 2021-11-15 stsp #define GOT_ERR_FILE_BINARY 146
164 e9ce266e 2022-03-07 op #define GOT_ERR_PATCH_MALFORMED 147
165 e9ce266e 2022-03-07 op #define GOT_ERR_PATCH_TRUNCATED 148
166 60aa1fa0 2022-03-17 op #define GOT_ERR_NO_PATCH 149
167 60aa1fa0 2022-03-17 op #define GOT_ERR_HUNK_FAILED 150
168 60aa1fa0 2022-03-17 op #define GOT_ERR_PATCH_FAILED 151
169 a7472cb3 2022-04-14 stsp #define GOT_ERR_FILEIDX_DUP_ENTRY 152
170 61af9b21 2022-06-28 stsp #define GOT_ERR_PIN_PACK 153
171 4d5ee956 2022-07-02 jrick #define GOT_ERR_BAD_TAG_SIGNATURE 154
172 4d5ee956 2022-07-02 jrick #define GOT_ERR_VERIFY_TAG_SIGNATURE 155
173 91d845ad 2022-07-03 jrick #define GOT_ERR_SIGNING_TAG 156
174 a4515c66 2023-02-13 mark /* 157 is currently unused */
175 58381f70 2022-09-03 op #define GOT_ERR_BAD_QUERYSTRING 158
176 e02b422b 2022-09-27 jrick #define GOT_ERR_INTEGRATE_BRANCH 159
177 13b2bc37 2022-10-23 stsp #define GOT_ERR_BAD_REQUEST 160
178 13b2bc37 2022-10-23 stsp #define GOT_ERR_CLIENT_ID 161
179 13b2bc37 2022-10-23 stsp #define GOT_ERR_REPO_TEMPFILE 162
180 13b2bc37 2022-10-23 stsp #define GOT_ERR_REFS_PROTECTED 163
181 13b2bc37 2022-10-23 stsp #define GOT_ERR_REF_PROTECTED 164
182 13b2bc37 2022-10-23 stsp #define GOT_ERR_REF_BUSY 165
183 21f07726 2022-10-31 stsp #define GOT_ERR_COMMIT_BAD_AUTHOR 166
184 365cf0f3 2022-12-29 stsp #define GOT_ERR_UID 167
185 365cf0f3 2022-12-29 stsp #define GOT_ERR_GID 168
186 6c5befc7 2023-03-28 stsp #define GOT_ERR_NO_PROG 169
187 6b5246e4 2023-06-05 stsp #define GOT_ERR_MERGE_COMMIT_OUT_OF_DATE 170
188 4027f31a 2017-11-04 stsp
189 70cc9832 2022-03-19 naddy struct got_error {
190 70cc9832 2022-03-19 naddy int code;
191 70cc9832 2022-03-19 naddy const char *msg;
192 4027f31a 2017-11-04 stsp };
193 4027f31a 2017-11-04 stsp
194 13b2bc37 2022-10-23 stsp #define GOT_ERR_MAX_MSG_SIZE 4080 /* includes '\0' */
195 13b2bc37 2022-10-23 stsp
196 0c60ce5a 2018-04-02 stsp /*
197 0c60ce5a 2018-04-02 stsp * Get an error object from the above list, for a given error code.
198 0c60ce5a 2018-04-02 stsp * The error message is fixed.
199 0c60ce5a 2018-04-02 stsp */
200 0c60ce5a 2018-04-02 stsp const struct got_error *got_error(int);
201 0c60ce5a 2018-04-02 stsp
202 0c60ce5a 2018-04-02 stsp /*
203 91a3d81f 2018-11-11 stsp * Get an error object from the above list, for a given error code.
204 91a3d81f 2018-11-11 stsp * Use the specified error message instead of the default one.
205 91a3d81f 2018-11-11 stsp * Caution: If the message buffer lives in dynamically allocated memory,
206 91a3d81f 2018-11-11 stsp * then this memory likely won't be freed.
207 91a3d81f 2018-11-11 stsp */
208 91a3d81f 2018-11-11 stsp const struct got_error *got_error_msg(int, const char *);
209 91a3d81f 2018-11-11 stsp
210 91a3d81f 2018-11-11 stsp /*
211 0c60ce5a 2018-04-02 stsp * Get a statically allocated error object with code GOT_ERR_ERRNO
212 230a42bd 2019-05-11 jcs * and an error message obtained from strerror(3), prefixed with a
213 230a42bd 2019-05-11 jcs * string.
214 0c60ce5a 2018-04-02 stsp */
215 638f9024 2019-05-13 stsp const struct got_error *got_error_from_errno(const char *);
216 0c60ce5a 2018-04-02 stsp
217 0c60ce5a 2018-04-02 stsp /*
218 48b8b0eb 2019-05-11 jcs * Get a statically allocated error object with code GOT_ERR_ERRNO
219 230a42bd 2019-05-11 jcs * and an error message obtained from strerror(3), prefixed with two
220 230a42bd 2019-05-11 jcs * strings.
221 48b8b0eb 2019-05-11 jcs */
222 638f9024 2019-05-13 stsp const struct got_error *got_error_from_errno2(const char *, const char *);
223 48b8b0eb 2019-05-11 jcs
224 48b8b0eb 2019-05-11 jcs /*
225 230a42bd 2019-05-11 jcs * Get a statically allocated error object with code GOT_ERR_ERRNO
226 230a42bd 2019-05-11 jcs * and an error message obtained from strerror(3), prefixed with three
227 230a42bd 2019-05-11 jcs * strings.
228 230a42bd 2019-05-11 jcs */
229 638f9024 2019-05-13 stsp const struct got_error *got_error_from_errno3(const char *, const char *,
230 230a42bd 2019-05-11 jcs const char *);
231 4cc6a5a5 2020-12-15 stsp
232 4cc6a5a5 2020-12-15 stsp /*
233 4cc6a5a5 2020-12-15 stsp * Get a statically allocated error object with code GOT_ERR_ERRNO
234 4cc6a5a5 2020-12-15 stsp * and an error message obtained from strerror(3), prefixed with a
235 4cc6a5a5 2020-12-15 stsp * string built with vsnprintf(3) from the provided format string
236 4cc6a5a5 2020-12-15 stsp * and the variable-length list of additional arguments.
237 4cc6a5a5 2020-12-15 stsp */
238 4cc6a5a5 2020-12-15 stsp const struct got_error *got_error_from_errno_fmt(const char *, ...);
239 230a42bd 2019-05-11 jcs
240 230a42bd 2019-05-11 jcs /*
241 1a76625f 2018-10-22 stsp * Set errno to the specified error code and return a statically
242 1a76625f 2018-10-22 stsp * allocated error object with code GOT_ERR_ERRNO and an error
243 2af4a041 2019-05-11 jcs * message obtained from strerror(3), optionally prefixed with a
244 2af4a041 2019-05-11 jcs * string.
245 1a76625f 2018-10-22 stsp */
246 2af4a041 2019-05-11 jcs const struct got_error *got_error_set_errno(int, const char *);
247 1a76625f 2018-10-22 stsp
248 1a76625f 2018-10-22 stsp /*
249 0c60ce5a 2018-04-02 stsp * If ferror(3) indicates an error status for the FILE, obtain an error
250 638f9024 2019-05-13 stsp * from got_error_from_errno(). Else, obtain the error via got_error()
251 0c60ce5a 2018-04-02 stsp * with the error code provided in the second argument.
252 0c60ce5a 2018-04-02 stsp */
253 8251fdbc 2018-01-12 stsp const struct got_error *got_ferror(FILE *, int);
254 91a3d81f 2018-11-11 stsp
255 91a3d81f 2018-11-11 stsp /*
256 91a3d81f 2018-11-11 stsp * Obtain an error with code GOT_ERR_NO_OBJ and an error message which
257 91a3d81f 2018-11-11 stsp * contains the specified object ID. The message buffer is statically
258 91a3d81f 2018-11-11 stsp * allocated; future invocations of this function will overwrite the
259 91a3d81f 2018-11-11 stsp * message set during earlier invocations.
260 91a3d81f 2018-11-11 stsp */
261 91a3d81f 2018-11-11 stsp struct got_object_id; /* forward declaration */
262 91a3d81f 2018-11-11 stsp const struct got_error *got_error_no_obj(struct got_object_id *);
263 3c23f6cd 2023-02-04 op
264 3c23f6cd 2023-02-04 op /*
265 3c23f6cd 2023-02-04 op * Obtain an error with code GOT_ERR_OBJ_CSUM and an error message which
266 3c23f6cd 2023-02-04 op * contains the specified object ID. The message buffer is statically
267 3c23f6cd 2023-02-04 op * allocated; future invocations of this function will overwrite the
268 3c23f6cd 2023-02-04 op * message set during earlier invocations.
269 3c23f6cd 2023-02-04 op */
270 3c23f6cd 2023-02-04 op const struct got_error *got_error_checksum(struct got_object_id *);
271 2aa0475c 2019-02-03 stsp
272 2aa0475c 2019-02-03 stsp /*
273 2aa0475c 2019-02-03 stsp * Obtain an error with code GOT_ERR_NOT_REF and an error message which
274 2aa0475c 2019-02-03 stsp * contains the specified reference name. The message buffer is statically
275 2aa0475c 2019-02-03 stsp * allocated; future invocations of this function will overwrite the
276 2aa0475c 2019-02-03 stsp * message set during earlier invocations.
277 2aa0475c 2019-02-03 stsp */
278 2aa0475c 2019-02-03 stsp const struct got_error *got_error_not_ref(const char *);
279 09589288 2019-03-10 stsp
280 09589288 2019-03-10 stsp /* Return an error based on a uuid(3) status code. */
281 cc483380 2019-09-01 stsp const struct got_error *got_error_uuid(uint32_t, const char *);
282 df056ada 2019-05-15 stsp
283 df056ada 2019-05-15 stsp /* Return an error with a path prefixed to the error message. */
284 df056ada 2019-05-15 stsp const struct got_error *got_error_path(const char *, int);
285 73e7eb7d 2020-12-15 stsp
286 73e7eb7d 2020-12-15 stsp /*
287 73e7eb7d 2020-12-15 stsp * Return an error with an error message prefix built by vsnprintf(3)
288 73e7eb7d 2020-12-15 stsp * from the provided format string and the variable-length list of
289 73e7eb7d 2020-12-15 stsp * additional arguments.
290 73e7eb7d 2020-12-15 stsp */
291 756050ac 2022-07-19 op const struct got_error *got_error_fmt(int, const char *, ...)
292 756050ac 2022-07-19 op __attribute__((__format__ (printf, 2, 3)));
293 5c02d2a5 2021-09-26 stsp
294 5c02d2a5 2021-09-26 stsp /*
295 5c02d2a5 2021-09-26 stsp * Check whether open(2) with O_NOFOLLOW failed on a symlink.
296 5c02d2a5 2021-09-26 stsp * This must be called directly after open(2) because it uses errno!
297 5c02d2a5 2021-09-26 stsp */
298 5c02d2a5 2021-09-26 stsp int got_err_open_nofollow_on_symlink(void);