From b283537d05301c91325a57bb0be742ca34809b2b Mon Sep 17 00:00:00 2001 From: Leonty Chudinov Date: Fri, 9 Oct 2020 08:38:05 +0500 Subject: [PATCH] Allow to change tag for all files in the directory excluding subdirectories Signed-off-by: Leonty Chudinov --- c/zosfile.c | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/c/zosfile.c b/c/zosfile.c index 26299688e..cdc6f0e7b 100644 --- a/c/zosfile.c +++ b/c/zosfile.c @@ -1637,11 +1637,6 @@ int directoryChangeTagRecursive(const char *pathName, char *type, goto ExitCodeError; } - /* If directory and not recursive, just return */ - if ((fileInfoIsDirectory(&info) && !recursive)) { - goto ExitCode; - } - /* Request is for a file. Handle it and exit */ if (fileInfoIsRegularFile(&info)) { if( -1 == patternChangeTagCheck (pathName, &returnCode, @@ -1680,21 +1675,17 @@ int directoryChangeTagRecursive(const char *pathName, char *type, goto ExitCodeError; } - if (fileInfoIsDirectory(&info)) { + if (fileInfoIsDirectory(&info) && recursive) { /* Change tag of all sub-directories and files there-in */ if (-1 == directoryChangeTagRecursive( pathBuffer, type, codepage, recursive, pattern, &returnCode, &reasonCode) ){ goto ExitCodeError; } - } - else { - /* change mode of this file, not a directory */ - if (fileInfoIsRegularFile(&info)) { - if( -1 == patternChangeTagCheck (pathBuffer, &returnCode, &reasonCode, - codepage, type, pattern)) { - goto ExitCodeError; - } + } else if (fileInfoIsRegularFile(&info)) { + if( -1 == patternChangeTagCheck (pathBuffer, &returnCode, &reasonCode, + codepage, type, pattern)) { + goto ExitCodeError; } } } /* End of for loop */