mirror of
https://gitee.com/openharmony/third_party_f2fs-tools
synced 2024-11-23 10:10:00 +00:00
libf2fs: avoid build warning
This avoids the below warnings. libf2fs_zoned.c:39:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf(file, "%s", str); ^ libf2fs_zoned.c: In function 'f2fs_get_zone_blocks': libf2fs_zoned.c:72:8: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result [-Wunused-result] fscanf(file, "%s", str); ^ Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
4b1ecd77a1
commit
0fe50b6f26
@ -26,6 +26,7 @@ void f2fs_get_zoned_model()
|
||||
{
|
||||
char str[128];
|
||||
FILE *file;
|
||||
int res;
|
||||
|
||||
/* Check that this is a zoned block device */
|
||||
snprintf(str, sizeof(str),
|
||||
@ -36,9 +37,12 @@ void f2fs_get_zoned_model()
|
||||
goto not_zoned;
|
||||
|
||||
memset(str, 0, sizeof(str));
|
||||
fscanf(file, "%s", str);
|
||||
res = fscanf(file, "%s", str);
|
||||
fclose(file);
|
||||
|
||||
if (res != 1)
|
||||
goto not_zoned;
|
||||
|
||||
if (strcmp(str, "host-aware") == 0) {
|
||||
c.zoned_model = F2FS_ZONED_HA;
|
||||
return;
|
||||
@ -57,6 +61,7 @@ int f2fs_get_zone_blocks()
|
||||
uint64_t sectors;
|
||||
char str[128];
|
||||
FILE *file;
|
||||
int res;
|
||||
|
||||
/* Get zone size */
|
||||
c.zone_blocks = 0;
|
||||
@ -69,9 +74,12 @@ int f2fs_get_zone_blocks()
|
||||
return -1;
|
||||
|
||||
memset(str, 0, sizeof(str));
|
||||
fscanf(file, "%s", str);
|
||||
res = fscanf(file, "%s", str);
|
||||
fclose(file);
|
||||
|
||||
if (res != 1)
|
||||
return -1;
|
||||
|
||||
sectors = atol(str);
|
||||
if (!sectors)
|
||||
return -1;
|
||||
|
Loading…
Reference in New Issue
Block a user