From 4fcb2c2a81d6eb20368dbd108edfa18088ca0f0a Mon Sep 17 00:00:00 2001 From: bobijam <bobijam> Date: Thu, 25 Oct 2007 05:58:18 +0000 Subject: [PATCH] Branch b1_6 b=13564 i=johann i=nathan error handling cleanup. --- lustre/include/lustre_lib.h | 6 +++--- lustre/utils/liblustreapi.c | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lustre/include/lustre_lib.h b/lustre/include/lustre_lib.h index 3636c8444b..e4f805239d 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 07610a7f53..e4764d474b 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); -- GitLab