This patch fixes the following -Werror=mismatched-dealloc error in
lustre_rsync.c:
lustre_rsync.c: In function ‘lr_locate_rsync’:
lustre_rsync.c:1472:17: error: ‘fclose’ called on pointer returned
from a mismatched allocation function [-Werror=mismatched-dealloc]
1472 | fclose(fp);
| ^~~~~~~~~~
lustre_rsync.c:1467:14: note: returned from ‘popen’
1467 | fp = popen(rsync, "r");
| ^~~~~~~~~~~~~~~~~
Test-Parameters: trivial testlist=lustre-rsync-test
Change-Id: I518db394a282c8e6123d878f63312bfb27c59235
Signed-off-by: Jian Yu <yujian@whamcloud.com>
Reviewed-on: https://review.whamcloud.com/45814
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: John L. Hammond <jhammond@whamcloud.com>
Reviewed-by: Alex Zhuravlev <bzzz@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
return -1;
if (fgets(rsync, sizeof(rsync), fp) == NULL) {
- fclose(fp);
+ pclose(fp);
return -1;
}
len = strlen(rsync);
if (len > 0 && rsync[len - 1] == '\n')
rsync[len - 1] = '\0';
- fclose(fp);
+ pclose(fp);
/* Determine the version of rsync */
snprintf(rsync_ver, sizeof(rsync_ver), "%s --version", rsync);
return -1;
if (fgets(rsync_ver, sizeof(rsync_ver), fp) == NULL) {
- fclose(fp);
+ pclose(fp);
return -1;
}
len = strlen(rsync_ver);
if (len > 0 && rsync_ver[len - 1] == '\n')
rsync_ver[len - 1] = '\0';
- fclose(fp);
+ pclose(fp);
return 0;
}