[OpenAFS-devel] afs_pioctl.c error returns

lamont@scriptkiddie.org lamont@scriptkiddie.org
Wed, 20 Apr 2005 15:49:29 -0700 (PDT)


afs_HandlePioctl() returns E2BIG when you pass it a buffer which isn't 
large enough to hold the output data from the pioctl call.  E2BIG 
translates to "Argument List Too Long" which isn't describing the right 
problem at all.  EINVAL fits better.  There may be an even more 
appropriate return (EOVERFLOW?) but E2BIG definitely isn't the right one.

--- src/afs/afs_pioctl.c~       Wed Apr 20 15:48:28 2005
+++ src/afs/afs_pioctl.c        Wed Apr 20 15:49:05 2005
@@ -1117,7 +1117,7 @@

      /* Do all range checking before continuing */
      if (inSize > MAXPIOCTLTOKENLEN || inSize < 0 || ablob->out_size < 0)
-       return E2BIG;
+       return EINVAL;

      /* Note that we use osi_Alloc for large allocs and 
osi_AllocLargeSpace for small ones */
      if (inSize > AFS_LRALLOCSIZ) {
@@ -1167,7 +1167,7 @@
      }
      if (code == 0 && ablob->out_size > 0) {
         if (outSize > ablob->out_size) {
-           code = E2BIG;       /* data wont fit in user buffer */
+           code = EINVAL;      /* data wont fit in user buffer */
         } else if (outSize) {
             AFS_COPYOUT(outData, ablob->out, outSize, code);
         }