summaryrefslogtreecommitdiff
path: root/src/logic/linkcmd/slbt_linkcmd_archive.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/logic/linkcmd/slbt_linkcmd_archive.c')
-rw-r--r--src/logic/linkcmd/slbt_linkcmd_archive.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/logic/linkcmd/slbt_linkcmd_archive.c b/src/logic/linkcmd/slbt_linkcmd_archive.c
index a8002fb..9b002f6 100644
--- a/src/logic/linkcmd/slbt_linkcmd_archive.c
+++ b/src/logic/linkcmd/slbt_linkcmd_archive.c
@@ -57,17 +57,26 @@ static int slbt_exec_link_remove_file(
const char * target)
{
int fdcwd;
-
- (void)ectx;
+ char * mark;
+ char * sbuf;
/* fdcwd */
fdcwd = slbt_driver_fdcwd(dctx);
/* remove target (if any) */
- if (!unlinkat(fdcwd,target,0) || (errno == ENOENT))
- return 0;
+ if (unlinkat(fdcwd,target,0) && (errno != ENOENT))
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ /* remove a previous .disabled placeholder */
+ sbuf = (slbt_get_exec_ictx(ectx))->sbuf;
+ mark = sbuf;
+ mark += sprintf(mark,"%s",target);
+ strcpy(mark,".disabled");
- return SLBT_SYSTEM_ERROR(dctx,0);
+ if (unlinkat(fdcwd,sbuf,0) && (errno != ENOENT))
+ return SLBT_SYSTEM_ERROR(dctx,0);
+
+ return 0;
}
slbt_hidden int slbt_exec_link_create_archive(