commit - e6eac3b8ebc595e916b1133437b204ca21ebee29
commit + f7d20e8910435defc9367c68c5af4418123d088e
blob - 435ee1d97e2cbf7f07b5608aec1e115279fc7850
blob + af1767503396d95abc5ad97aeaf9ecc73226817f
--- lib/got_lib_path.h
+++ lib/got_lib_path.h
* and resolving references to parent directories ("/../").
* Relative paths are copied from input to buf as-is.
*/
-int got_canonpath(const char *input, char *buf, size_t bufsize)
+const struct got_error *got_canonpath(const char *, char *, size_t);
blob - fa26c7a7e5b5421a2282d81af15d789f189d004b
blob + d14f81c3e51d80411824abe499bce05da745ce55
--- lib/path.c
+++ lib/path.c
return resolved;
}
-/* canonpath() from kern_pledge.c */
-int
+/* based on canonpath() from kern_pledge.c */
+const struct got_error *
got_canonpath(const char *input, char *buf, size_t bufsize)
{
const char *p;
/* can't canon relative paths, don't bother */
if (!got_path_is_absolute(input)) {
if (strlcpy(buf, input, bufsize) >= bufsize)
- return ENAMETOOLONG;
- return 0;
+ return got_error(GOT_ERR_NO_SPACE);
+ return NULL;
}
p = input;
}
if ((*p == '\0') && (q - buf < bufsize)) {
*q = 0;
- return 0;
+ return NULL;
} else
- return ENAMETOOLONG;
+ return got_error(GOT_ERR_NO_SPACE);
}