Skip to content

Commit

Permalink
[HADOOP-4603] Applied a local patch.
Browse files Browse the repository at this point in the history
  • Loading branch information
kohsuke committed Mar 15, 2009
1 parent 971e3f7 commit 0fe42e9
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions src/core/org/apache/hadoop/security/UnixUserGroupInformation.java
Expand Up @@ -302,10 +302,21 @@ private static String toString(String[] strArray) {
* @throws IOException if encounter any error while running the command
*/
static String getUnixUserName() throws IOException {
String[] result = executeShellCommand(
String[] result;
try {
result = executeShellCommand(
new String[]{Shell.USER_NAME_COMMAND});
} catch (IOException e) {
try {
// in case this is on Solaris
result = executeShellCommand(
new String[]{"/usr/ucb/whoami"});
} catch (IOException _) {
throw e; // report the original problem
}
}
if (result.length!=1) {
throw new IOException("Expect one token as the result of " +
throw new IOException("Expect one token as the result of " +
Shell.USER_NAME_COMMAND + ": " + toString(result));
}
return result[0];
Expand Down

0 comments on commit 0fe42e9

Please sign in to comment.