diff --git a/src/os/user/cgo_lookup_cgo.go b/src/os/user/cgo_lookup_cgo.go index 17995738d24..7bb1da263ed 100644 --- a/src/os/user/cgo_lookup_cgo.go +++ b/src/os/user/cgo_lookup_cgo.go @@ -17,37 +17,42 @@ import ( #include #include #include +#include static struct passwd mygetpwuid_r(int uid, char *buf, size_t buflen, int *found, int *perr) { struct passwd pwd; - struct passwd *result; - *perr = getpwuid_r(uid, &pwd, buf, buflen, &result); - *found = result != NULL; - return pwd; + struct passwd *result; + memset (&pwd, 0, sizeof(pwd)); + *perr = getpwuid_r(uid, &pwd, buf, buflen, &result); + *found = result != NULL; + return pwd; } static struct passwd mygetpwnam_r(const char *name, char *buf, size_t buflen, int *found, int *perr) { struct passwd pwd; - struct passwd *result; - *perr = getpwnam_r(name, &pwd, buf, buflen, &result); - *found = result != NULL; - return pwd; + struct passwd *result; + memset(&pwd, 0, sizeof(pwd)); + *perr = getpwnam_r(name, &pwd, buf, buflen, &result); + *found = result != NULL; + return pwd; } static struct group mygetgrgid_r(int gid, char *buf, size_t buflen, int *found, int *perr) { struct group grp; - struct group *result; - *perr = getgrgid_r(gid, &grp, buf, buflen, &result); - *found = result != NULL; - return grp; + struct group *result; + memset(&grp, 0, sizeof(grp)); + *perr = getgrgid_r(gid, &grp, buf, buflen, &result); + *found = result != NULL; + return grp; } static struct group mygetgrnam_r(const char *name, char *buf, size_t buflen, int *found, int *perr) { struct group grp; - struct group *result; - *perr = getgrnam_r(name, &grp, buf, buflen, &result); - *found = result != NULL; - return grp; + struct group *result; + memset(&grp, 0, sizeof(grp)); + *perr = getgrnam_r(name, &grp, buf, buflen, &result); + *found = result != NULL; + return grp; } */ import "C"