Skip to content

Commit

Permalink
Merge pull request #176 from lchudinov/feature/chtag-for-directory-no…
Browse files Browse the repository at this point in the history
…n-recursive

Allow to change tag for all files in the directory excluding subdirectories
  • Loading branch information
1000TurquoisePogs authored Oct 13, 2020
2 parents 58eac80 + b283537 commit b35a3b8
Showing 1 changed file with 5 additions and 14 deletions.
19 changes: 5 additions & 14 deletions c/zosfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 */
Expand Down

0 comments on commit b35a3b8

Please sign in to comment.