Restore the implementation of uv_os_getenv() shim

Somewhere in the move from netmgr/uv-compat.h to uv.c, the
uv_os_getenv() implementation was lost in the process.  Restore the
implementation, so we can support Debian stretch for couple more months.
This commit is contained in:
Ondřej Surý 2022-05-04 12:31:46 +02:00
parent 4e8d1207ff
commit a0a102cc50

View file

@ -20,6 +20,23 @@
#include <stdlib.h>
#include <string.h>
int
uv_os_getenv(const char *name, char *buffer, size_t *size) {
size_t len;
char *buf = getenv(name);
if (buf == NULL) {
return (UV_ENOENT);
}
len = strlen(buf) + 1;
if (len > *size) {
*size = len;
return (UV_ENOBUFS);
}
*size = len;
memmove(buffer, buf, len);
return (0);
}
#endif
#if UV_VERSION_HEX < UV_VERSION(1, 27, 0)