bozo: Use BZIO for out of memory errors 30/15030/3
authorMichael Meffie <mmeffie@sinenomine.net>
Wed, 8 Jun 2022 12:36:10 +0000 (08:36 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Tue, 21 Jun 2022 23:47:01 +0000 (19:47 -0400)
Return a BZ error code over the wire when memory cannot be allocated,
since ENOMEM is not a portable wire error code.

Use BZIO for these errors to be consistent with the existing bosserver
code added in commit fda2bc874751ca479365dc6389c0eebb41a0bda1 (Allocate
pathname buffers dynamically).

The incorrect error codes were added in:

fda2bc874751ca479365dc6389c0eebb41a0bda1 Allocate pathname buffers dynamically
381597851b659f00747b22efc24240073c4403ce bozo: Fix problems found by static analysis

Change-Id: I6e19aba226441159ba9e7d4173d2145f5d6745c2
Reviewed-on: https://gerrit.openafs.org/15030
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>

src/bozo/bosoprocs.c

index 5c00176..324c328 100644 (file)
@@ -306,13 +306,13 @@ SBOZO_Install(struct rx_call *acall, char *aname, afs_int32 asize, afs_int32 mod
        return BZNOENT;
     }
     if (asprintf(&fpNew, "%s.NEW", filepath) < 0) {
-       ret = ENOMEM;
+       ret = BZIO;
        fpNew = NULL;
        goto out;
     }
     tbuffer = malloc(AFSDIR_PATH_MAX);
     if (tbuffer == NULL) {
-       ret =  ENOMEM;
+       ret = BZIO;
        goto out;
     }
 
@@ -433,7 +433,7 @@ SBOZO_GetCellName(struct rx_call *acall, char **aname)
     if (code == 0) {
        *aname = strdup(tname);
        if (*aname == NULL)
-           code = ENOMEM;
+           code = BZIO;
     }
 
     return code;