diff options
Diffstat (limited to 'src/internal')
-rw-r--r-- | src/internal/slibtool_symlink_impl.c | 14 | ||||
-rw-r--r-- | src/internal/slibtool_symlink_impl.h | 6 |
2 files changed, 17 insertions, 3 deletions
diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c index ca7f6cd..0b1daa0 100644 --- a/src/internal/slibtool_symlink_impl.c +++ b/src/internal/slibtool_symlink_impl.c @@ -23,9 +23,11 @@ int slbt_create_symlink( struct slbt_exec_ctx * ectx, const char * target, const char * lnkname, - bool flawrapper) + uint32_t options) { int fdcwd; + int fliteral; + int fwrapper; char ** oargv; const char * slash; char * ln[5]; @@ -36,12 +38,20 @@ int slbt_create_symlink( char atarget[PATH_MAX]; char * suffix = 0; + /* options */ + fliteral = (options & SLBT_SYMLINK_LITERAL); + fwrapper = (options & SLBT_SYMLINK_WRAPPER); + /* symlink is a placeholder? */ if ((dctx->cctx->drvflags & SLBT_DEV_NULL_FLAGS) && !strcmp(target,"/dev/null")) { slash = target; suffix = ".disabled"; + /* target is an absolute path? */ + } else if (fliteral) { + slash = target; + /* symlink target contains a dirname? */ } else if ((slash = strrchr(target,'/'))) { slash++; @@ -52,7 +62,7 @@ int slbt_create_symlink( } /* .la wrapper? */ - dotdot = flawrapper ? "../" : ""; + dotdot = fwrapper ? "../" : ""; /* atarget */ if ((size_t)snprintf(atarget,sizeof(atarget),"%s%s", diff --git a/src/internal/slibtool_symlink_impl.h b/src/internal/slibtool_symlink_impl.h index 402208c..5619e75 100644 --- a/src/internal/slibtool_symlink_impl.h +++ b/src/internal/slibtool_symlink_impl.h @@ -4,12 +4,16 @@ #include <stdbool.h> #include <slibtool/slibtool.h> +#define SLBT_SYMLINK_DEFAULT 0x0000 +#define SLBT_SYMLINK_LITERAL 0x0001 +#define SLBT_SYMLINK_WRAPPER 0x0002 + int slbt_create_symlink( const struct slbt_driver_ctx * dctx, struct slbt_exec_ctx * ectx, const char * target, const char * lnkname, - bool flawrapper); + uint32_t options); int slbt_symlink_is_a_placeholder(int fdcwd, char * lnkpath); |