From bf7b809c1fb380a9c4c48b7496c5c174d17d432d Mon Sep 17 00:00:00 2001 From: bobijam Date: Thu, 25 Oct 2007 05:59:56 +0000 Subject: [PATCH] Branch HEAD 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 210df34..20f73e0 100644 --- a/lustre/include/lustre_lib.h +++ b/lustre/include/lustre_lib.h @@ -251,12 +251,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)); @@ -270,7 +270,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 a6ddb9d..5ea3ee8 100644 --- a/lustre/utils/liblustreapi.c +++ b/lustre/utils/liblustreapi.c @@ -1026,9 +1026,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); -- 1.8.3.1