HDFS-10193. fuse_dfs segfaults if uid cannot be resolved to a username (John Thiltges via cmccabe)

(cherry picked from commit 0d19a0ce98)
This commit is contained in:
Colin Patrick Mccabe 2016-03-23 11:19:18 -07:00
parent 76602161c0
commit 7ad3162df4
1 changed files with 5 additions and 0 deletions

View File

@ -570,6 +570,11 @@ int fuseConnectAsThreadUid(struct hdfsConn **conn)
ctx = fuse_get_context(); ctx = fuse_get_context();
usrname = getUsername(ctx->uid); usrname = getUsername(ctx->uid);
if (!usrname) {
ERROR("fuseConnectAsThreadUid(): failed to get username for uid %"PRId64
"\n", (uint64_t)ctx->uid);
return EIO;
}
ret = fuseConnect(usrname, ctx, conn); ret = fuseConnect(usrname, ctx, conn);
free(usrname); free(usrname);
return ret; return ret;