Whamcloud - gitweb
Branch b1_6
authorbobijam <bobijam>
Thu, 25 Oct 2007 05:58:18 +0000 (05:58 +0000)
committerbobijam <bobijam>
Thu, 25 Oct 2007 05:58:18 +0000 (05:58 +0000)
b=13564
i=johann
i=nathan

error handling cleanup.

lustre/include/lustre_lib.h
lustre/utils/liblustreapi.c

index 3636c84..e4f8052 100644 (file)
@@ -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;
 }
index 07610a7..e4764d4 100644 (file)
@@ -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);