summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-09-02 16:15:11 -0400
committermidipix <writeonce@midipix.org>2016-09-03 23:23:22 -0400
commitd56ead6e8bf4e3921639033e6bec35f3589ee0c4 (patch)
tree3e383630afe0f33b954b8d3c927ddd9b83666067 /src
parent3d54f34316385e007fa78451e714e751e648dc27 (diff)
downloadslibtool-d56ead6e8bf4e3921639033e6bec35f3589ee0c4.tar.bz2
slibtool-d56ead6e8bf4e3921639033e6bec35f3589ee0c4.tar.xz
slbt_create_symlink(): added error trace support.
Diffstat (limited to 'src')
-rw-r--r--src/internal/slibtool_symlink_impl.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c
index 4c4cceb..42185e8 100644
--- a/src/internal/slibtool_symlink_impl.c
+++ b/src/internal/slibtool_symlink_impl.c
@@ -9,6 +9,7 @@
#include <stdbool.h>
#include <unistd.h>
+#include "slibtool_errinfo_impl.h"
#include "slibtool_symlink_impl.h"
#define SLBT_DEV_NULL_FLAGS (SLBT_DRIVER_ALL_STATIC \
@@ -42,12 +43,12 @@ int slbt_create_symlink(
if ((size_t)snprintf(atarget,sizeof(atarget),"%s%s",
dotdot,slash) >= sizeof(atarget))
- return -1;
+ return SLBT_BUFFER_ERROR(dctx);
/* tmplnk */
if ((size_t)snprintf(tmplnk,sizeof(tmplnk),"%s.symlink.tmp",
lnkname) >= sizeof(tmplnk))
- return -1;
+ return SLBT_BUFFER_ERROR(dctx);
/* lnkarg */
strcpy(lnkarg,lnkname);
@@ -67,12 +68,12 @@ int slbt_create_symlink(
if (dctx->cctx->mode == SLBT_MODE_LINK) {
if (slbt_output_link(dctx,ectx)) {
ectx->argv = oargv;
- return -1;
+ return SLBT_NESTED_ERROR(dctx);
}
} else {
if (slbt_output_install(dctx,ectx)) {
ectx->argv = oargv;
- return -1;
+ return SLBT_NESTED_ERROR(dctx);
}
}
}
@@ -82,7 +83,9 @@ int slbt_create_symlink(
/* create symlink */
if (symlink(atarget,tmplnk))
- return -1;
+ return SLBT_SYSTEM_ERROR(dctx);
- return rename(tmplnk,lnkname);
+ return rename(tmplnk,lnkname)
+ ? SLBT_SYSTEM_ERROR(dctx)
+ : 0;
}