From 6beda1bcee4396ceced99b8a8c5627940f507ace Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 20 Dec 2020 23:09:31 +0000 Subject: internals: error tracing: record the not-found path upon ENOENT as needed. --- src/internal/slibtool_errinfo_impl.c | 2 +- src/internal/slibtool_errinfo_impl.h | 4 ++-- src/internal/slibtool_lconf_impl.c | 8 ++++---- src/internal/slibtool_libmeta_impl.c | 8 ++++---- src/internal/slibtool_objmeta_impl.c | 8 ++++---- src/internal/slibtool_symlink_impl.c | 4 ++-- 6 files changed, 17 insertions(+), 17 deletions(-) (limited to 'src/internal') diff --git a/src/internal/slibtool_errinfo_impl.c b/src/internal/slibtool_errinfo_impl.c index 472c818..84f019e 100644 --- a/src/internal/slibtool_errinfo_impl.c +++ b/src/internal/slibtool_errinfo_impl.c @@ -34,7 +34,7 @@ int slbt_record_error( erri->efunction = efunction; erri->eline = eline; erri->eflags = eflags; - erri->eany = eany; + erri->eany = (eany && (esyscode == ENOENT)) ? strdup(eany) : eany; ictx->errinfp++; diff --git a/src/internal/slibtool_errinfo_impl.h b/src/internal/slibtool_errinfo_impl.h index a1d3b61..1c3fb9f 100644 --- a/src/internal/slibtool_errinfo_impl.h +++ b/src/internal/slibtool_errinfo_impl.h @@ -19,7 +19,7 @@ int slbt_record_error( unsigned eflags, void * eany); -#define SLBT_SYSTEM_ERROR(dctx) \ +#define SLBT_SYSTEM_ERROR(dctx,eany) \ slbt_record_error( \ dctx, \ errno, \ @@ -27,7 +27,7 @@ int slbt_record_error( __func__, \ __LINE__, \ SLBT_ERROR_TOP_LEVEL, \ - 0) + (void *)eany) #define SLBT_BUFFER_ERROR(dctx) \ slbt_record_error( \ diff --git a/src/internal/slibtool_lconf_impl.c b/src/internal/slibtool_lconf_impl.c index 6b55c9f..ad335f1 100644 --- a/src/internal/slibtool_lconf_impl.c +++ b/src/internal/slibtool_lconf_impl.c @@ -51,7 +51,7 @@ static int slbt_lconf_open( : fdlconf; if (fstatat(fdlconfdir,".",&stcwd,0) < 0) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,0); lconf = lconf ? lconf : "libtool"; fdlconf = openat(fdlconfdir,lconf,O_RDONLY,0); @@ -62,11 +62,11 @@ static int slbt_lconf_open( slbt_lconf_close(fdcwd,fdlconfdir); if (fdparent < 0) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,0); if (fstat(fdparent,&stparent) < 0) { close(fdparent); - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,0); } if (stparent.st_dev != stcwd.st_dev) { @@ -115,7 +115,7 @@ int slbt_get_lconf_flags( /* map relative libtool script */ if (fstat(fdlconf,&st) < 0) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,0); addr = mmap( 0,st.st_size, diff --git a/src/internal/slibtool_libmeta_impl.c b/src/internal/slibtool_libmeta_impl.c index 18984bd..31d060d 100644 --- a/src/internal/slibtool_libmeta_impl.c +++ b/src/internal/slibtool_libmeta_impl.c @@ -41,7 +41,7 @@ static int slbt_create_default_library_wrapper( dctx->cctx->output, O_RDWR|O_CREAT|O_TRUNC, 0644)) < 0) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,dctx->cctx->output); /* version info */ current = 0; @@ -124,7 +124,7 @@ static int slbt_create_default_library_wrapper( close(fdout); - return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx) : 0; + return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx,0) : 0; } static int slbt_create_compatible_library_wrapper( @@ -153,7 +153,7 @@ static int slbt_create_compatible_library_wrapper( dctx->cctx->output, O_RDWR|O_CREAT|O_TRUNC, 0644)) < 0) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,dctx->cctx->output); /* version info */ current = 0; @@ -263,7 +263,7 @@ static int slbt_create_compatible_library_wrapper( close(fdout); - return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx) : 0; + return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx,0) : 0; } int slbt_create_library_wrapper( diff --git a/src/internal/slibtool_objmeta_impl.c b/src/internal/slibtool_objmeta_impl.c index b38cf75..f1a33d0 100644 --- a/src/internal/slibtool_objmeta_impl.c +++ b/src/internal/slibtool_objmeta_impl.c @@ -25,7 +25,7 @@ static int slbt_create_default_object_wrapper( ectx->ltobjname, O_RDWR|O_CREAT|O_TRUNC, 0644)) < 0) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,ectx->ltobjname); verinfo = slbt_source_version(); @@ -50,7 +50,7 @@ static int slbt_create_default_object_wrapper( close(fdout); - return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx) : 0; + return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx,0) : 0; } static int slbt_create_compatible_object_wrapper( @@ -66,7 +66,7 @@ static int slbt_create_compatible_object_wrapper( ectx->ltobjname, O_RDWR|O_CREAT|O_TRUNC, 0644)) < 0) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx, ectx->ltobjname); verinfo = slbt_source_version(); @@ -98,7 +98,7 @@ static int slbt_create_compatible_object_wrapper( close(fdout); - return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx) : 0; + return (ret < 0) ? SLBT_SYSTEM_ERROR(dctx,0) : 0; } int slbt_create_object_wrapper( diff --git a/src/internal/slibtool_symlink_impl.c b/src/internal/slibtool_symlink_impl.c index 5ce9158..dd91d5e 100644 --- a/src/internal/slibtool_symlink_impl.c +++ b/src/internal/slibtool_symlink_impl.c @@ -101,10 +101,10 @@ int slbt_create_symlink( /* create symlink */ if (symlink(atarget,tmplnk)) - return SLBT_SYSTEM_ERROR(dctx); + return SLBT_SYSTEM_ERROR(dctx,tmplnk); return rename(tmplnk,lnkname) - ? SLBT_SYSTEM_ERROR(dctx) + ? SLBT_SYSTEM_ERROR(dctx,lnkname) : 0; } -- cgit v1.2.3