From 6df4741f840832886716145cf81654d5a0a9e2e0 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Thu, 5 Sep 2013 21:47:08 +0200 Subject: [PATCH] src: fix solaris 10 build error Stop gcc from getting confused, explicitly cast the return value from getuid() and getgid() to uint32_t. Fixes the following build error: ../src/node.cc: In function 'void node::GetUid(const v8::FunctionCallbackInfo&)': ../src/node.cc:1552:37: error: call of overloaded 'Set(uid_t)' is ambiguous ../src/node.cc:1552:37: note: candidates are: ../deps/v8/include/v8.h:5939:6: note: void v8::ReturnValue::Set(bool) [with T = v8::Value] ../deps/v8/include/v8.h:5909:6: note: void v8::ReturnValue::Set(double) [with T = v8::Value] ../deps/v8/include/v8.h:5915:6: note: void v8::ReturnValue::Set(int32_t) [with T = v8::Value, int32_t = int] ../deps/v8/include/v8.h:5926:6: note: void v8::ReturnValue::Set(uint32_t) [with T = v8::Value, uint32_t = unsigned int] Fixes #6182. --- src/node.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node.cc b/src/node.cc index 3f49ec4edb7..c88b0effbac 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1549,12 +1549,14 @@ static gid_t gid_by_name(Handle value) { static void GetUid(const FunctionCallbackInfo& args) { - args.GetReturnValue().Set(getuid()); + // uid_t is an uint32_t on all supported platforms. + args.GetReturnValue().Set(static_cast(getuid())); } static void GetGid(const FunctionCallbackInfo& args) { - args.GetReturnValue().Set(getgid()); + // gid_t is an uint32_t on all supported platforms. + args.GetReturnValue().Set(static_cast(getgid())); }