From fadae57393e1bac94e3f2b35f89eab664a013843 Mon Sep 17 00:00:00 2001 From: onefang Date: Fri, 18 Mar 2022 21:11:47 +1000 Subject: Safer directory deletes. --- src/sledjchisl/sledjchisl.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 2c96496..73a29f3 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -1345,9 +1345,9 @@ static void buildOpensim() if (shellMeFail("cd %s; find -name *.csproj -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!"); if (shellMeFail("cd %s; find -name *.csproj.* -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!"); if (shellMeFail("cd %s; find -name *.pdb -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!"); - if (shellMeFail("cd %s; rm -fr bin/ScriptEngines", t)) E("Failed to rm ScriptEngines!"); + if (shellMeFail("rm -fr %s/bin/ScriptEngines", t)) E("Failed to rm ScriptEngines!"); // Clean the stuff the tests created. - if (shellMeFail("cd %s; rm Test*.txt", t)) E("Failed to Test results!"); + if (shellMeFail("rm %s/Test*.txt", t)) E("Failed to Test results!"); /* # Prebuild converts Microsoft.CSharp.targets to Microsoft.CSHARP.Targets, which case sensitive file systems fail to find. #find -name *.csproj | xargs sed -i "s@Microsoft.CSHARP.Targets@Microsoft.CSharp.targets@g" @@ -2485,7 +2485,7 @@ TODO - if (strcmp(".oar", &t[l - 4]) == 0) {t[l - 4] = '\0'; l -= 4;} I("Adding %s to %s", ourARs->ARs[i], gtr); // Deal with deletions in the inventory / sim, easy method, which becomes a nop for files that stay in the git add below. - if (shellMeFail("cd %s/%s; rm -fr * >>%s", dir, gar, gerr)) E("Failed to rm!"); + if (shellMeFail("rm -fr %s/%s/* >>%s", dir, gar, gerr)) E("Failed to rm!"); if (shellMeFail("cd %s/%s; ionice -c3 nice -n 19 tar -xzf \"%s/%s\" || echo \"ERROR - Could not unpack %s !\" >>%s", dir, gar, scBackup, ourARs->ARs[i], ourARs->ARs[i], gerr)) E("Failed to unpack %s!", ourARs->ARs[i]); if (!hasContents(gerr)) -- cgit v1.1