Skip to content

Commit 44be4a4

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 edadd9b commit 44be4a4

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
@@ -1596,11 +1596,12 @@ static int acl_pkg_unpack_buffer_or_file(const char *buffer, size_t buffer_size,
15961596
return 0;
15971597
}
15981598

1599-
// Create output directory (ignore any errors).
1599+
// Create output directory (ignore any errors to avoid error-prone,
1600+
// platform-dependent error handling).
16001601
#ifdef _WIN32
1601-
CreateDirectory(full_name, NULL);
1602+
(void)CreateDirectory(full_name, NULL);
16021603
#else
1603-
mkdir(full_name, 0755);
1604+
(void)mkdir(full_name, 0755);
16041605
#endif
16051606
full_name[out_dir_length] = '/';
16061607

@@ -1645,10 +1646,12 @@ static int acl_pkg_unpack_buffer_or_file(const char *buffer, size_t buffer_size,
16451646
}
16461647

16471648
if (info.kind == PACK_DIR) {
1649+
// Create output directory (ignore any errors to avoid error-prone,
1650+
// platform-dependent error handling).
16481651
#ifdef _WIN32
1649-
CreateDirectory(full_name, NULL);
1652+
(void)CreateDirectory(full_name, NULL);
16501653
#else
1651-
mkdir(full_name, 0755);
1654+
(void)mkdir(full_name, 0755);
16521655
#endif
16531656
} else {
16541657
// Read file contents

0 commit comments

Comments
 (0)