bozo: Use BZIO for out of memory errors

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>
This commit is contained in:
Michael Meffie 2022-06-08 08:36:10 -04:00 committed by Benjamin Kaduk
parent 44e24ae5d7
commit 61c391bf7c

View 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;