diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 3636c8444b1b5d8c93e524015e788280fca45b73..e4f805239dc8c84051e6c76a6a5c175d8878f950 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -247,12 +247,12 @@ static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf, data->ioc_version = OBD_IOCTL_VERSION; if (*pbuf && data->ioc_len > max) - return 1; + return -EINVAL; if (*pbuf == NULL) { *pbuf = malloc(data->ioc_len); } if (!*pbuf) - return 1; + return -ENOMEM; overlay = (struct obd_ioctl_data *)*pbuf; memcpy(*pbuf, data, sizeof(*data)); @@ -266,7 +266,7 @@ static inline int obd_ioctl_pack(struct obd_ioctl_data *data, char **pbuf, if (data->ioc_inlbuf4) LOGL(data->ioc_inlbuf4, data->ioc_inllen4, ptr); if (obd_ioctl_is_invalid(overlay)) - return 1; + return -EINVAL; return 0; } diff --git a/lustre/utils/liblustreapi.c b/lustre/utils/liblustreapi.c index 07610a7f538f3fd1f4c25b3002e3bad656466632..e4764d474bba3adb4eca156b8a41641f776137cf 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1195,9 +1195,9 @@ int llapi_obd_statfs(char *path, __u32 type, __u32 index, data.ioc_pbuf2 = (char *)uuid_buf; data.ioc_plen2 = sizeof(struct obd_uuid); - if (obd_ioctl_pack(&data, &rawbuf, sizeof(raw))) { + if ((rc = obd_ioctl_pack(&data, &rawbuf, sizeof(raw))) != 0) { fprintf(stderr, "llapi_obd_statfs: error packing ioctl data\n"); - return -EINVAL; + return rc; } fd = open(path, O_RDONLY);