mirror of
https://github.com/rvtr/GodMode9i.git
synced 2025-11-02 00:11:07 -04:00
Run closedir(isDir); after checking isDir
This commit is contained in:
parent
9651648836
commit
013ffe654d
@ -47,6 +47,9 @@ int fcopy(const char *sourcePath, const char *destinationPath)
|
||||
DIR *isDir = opendir (sourcePath);
|
||||
|
||||
if (isDir != NULL) {
|
||||
closedir(isDir);
|
||||
|
||||
// Source path is a directory
|
||||
chdir(sourcePath);
|
||||
vector<DirEntry> dirContents;
|
||||
getDirectoryContents(dirContents);
|
||||
@ -63,6 +66,9 @@ int fcopy(const char *sourcePath, const char *destinationPath)
|
||||
chdir ("..");
|
||||
return 1;
|
||||
} else {
|
||||
closedir(isDir);
|
||||
|
||||
// Source path is a file
|
||||
FILE* sourceFile = fopen(sourcePath, "rb");
|
||||
off_t fsize = 0;
|
||||
if (sourceFile) {
|
||||
@ -119,5 +125,4 @@ int fcopy(const char *sourcePath, const char *destinationPath)
|
||||
|
||||
return -1;
|
||||
}
|
||||
closedir(isDir);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user