Skip to content

Commit 4672764

Browse files
Fix Coverity issue CHECKED_RETURN
lib/pkg_editor/src/pkg_editor.c:1651:7: Type: Unchecked return value from library (CHECKED_RETURN) lib/pkg_editor/src/pkg_editor.c:1584:3: Unchecked call to function 1. path: Condition "buffer != NULL", taking true branch. lib/pkg_editor/src/pkg_editor.c:1585:5: 2. path: Condition "input == NULL", taking true branch. lib/pkg_editor/src/pkg_editor.c:1585:5: 3. path: Falling through to end of if statement. lib/pkg_editor/src/pkg_editor.c:1588:3: 4. path: Falling through to end of if statement. lib/pkg_editor/src/pkg_editor.c:1594:3: 5. path: Condition "ret != 0", taking false branch. lib/pkg_editor/src/pkg_editor.c:1610:3: 6. path: Condition "z_info.strm.avail_in > 0", taking true branch. lib/pkg_editor/src/pkg_editor.c:1612:5: 7. path: Condition "!read_data(&info, 20UL /* sizeof (info) */, &z_info, input)", taking false branch. lib/pkg_editor/src/pkg_editor.c:1617:5: 8. path: Condition "info.magic != 3203399403U", taking false branch. lib/pkg_editor/src/pkg_editor.c:1625:5: 9. path: Condition "info.kind == PACK_END", taking false branch. lib/pkg_editor/src/pkg_editor.c:1630:5: 10. path: Condition "!read_data(name, info.name_length, &z_info, input)", taking false branch. lib/pkg_editor/src/pkg_editor.c:1638:5: 11. path: Condition "12288UL /* 3 * 4096 */ < out_dir_length", taking true branch. lib/pkg_editor/src/pkg_editor.c:1643:5: 12. path: Condition "full_name[12287 /* 3 * 4096 - 1 */] != 0", taking true branch. lib/pkg_editor/src/pkg_editor.c:1647:5: 13. path: Condition "info.kind == PACK_DIR", taking true branch. lib/pkg_editor/src/pkg_editor.c:1651:7: 14. check_return: Calling "mkdir(full_name, 493U)" without checking return value. This library function may fail and return an error code. lib/pkg_editor/src/pkg_editor.c:1604:3: Type: Unchecked return value from library (CHECKED_RETURN) lib/pkg_editor/src/pkg_editor.c:1584:3: Unchecked call to function 1. path: Condition "buffer != NULL", taking true branch. lib/pkg_editor/src/pkg_editor.c:1585:5: 2. path: Condition "input == NULL", taking true branch. lib/pkg_editor/src/pkg_editor.c:1585:5: 3. path: Falling through to end of if statement. lib/pkg_editor/src/pkg_editor.c:1588:3: 4. path: Falling through to end of if statement. lib/pkg_editor/src/pkg_editor.c:1594:3: 5. path: Condition "ret != 0", taking false branch. lib/pkg_editor/src/pkg_editor.c:1604:3: 6. check_return: Calling "mkdir(full_name, 493U)" without checking return value. This library function may fail and return an error code.
1 parent a550c3e commit 4672764

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

lib/pkg_editor/src/pkg_editor.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,11 +1603,12 @@ static int acl_pkg_unpack_buffer_or_file(const char *buffer, size_t buffer_size,
16031603
return 0;
16041604
}
16051605

1606-
// Create output directory (ignore any errors).
1606+
// Create output directory (ignore any errors to avoid error-prone,
1607+
// platform-dependent error handling).
16071608
#ifdef _WIN32
1608-
CreateDirectory(full_name, NULL);
1609+
(void)CreateDirectory(full_name, NULL);
16091610
#else
1610-
mkdir(full_name, 0755);
1611+
(void)mkdir(full_name, 0755);
16111612
#endif
16121613
full_name[out_dir_length] = '/';
16131614

@@ -1652,10 +1653,12 @@ static int acl_pkg_unpack_buffer_or_file(const char *buffer, size_t buffer_size,
16521653
}
16531654

16541655
if (info.kind == PACK_DIR) {
1656+
// Create output directory (ignore any errors to avoid error-prone,
1657+
// platform-dependent error handling).
16551658
#ifdef _WIN32
1656-
CreateDirectory(full_name, NULL);
1659+
(void)CreateDirectory(full_name, NULL);
16571660
#else
1658-
mkdir(full_name, 0755);
1661+
(void)mkdir(full_name, 0755);
16591662
#endif
16601663
} else {
16611664
// Read file contents

0 commit comments

Comments
 (0)