Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[FIX JENKINS-22818] fix jenkins restart on Linux after plugin update …
…if the java executable running Jenkins is started without its full path

The patch uses 'execvp' instead of 'execv' to lookup the java executable filename in the PATH if the specified filename does not contain a slash (/) character.
Regression introduced in 547d4ed

(cherry picked from commit 3ddd2b0)
  • Loading branch information
ydubreuil authored and olivergondza committed Jul 2, 2014
1 parent afe7da5 commit c3ddea2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/hudson/lifecycle/UnixLifecycle.java
Expand Up @@ -80,7 +80,7 @@ public void restart() throws IOException, InterruptedException {

// exec to self
String exe = args.get(0);
LIBC.execv(exe, new StringArray(args.toArray(new String[args.size()])));
LIBC.execvp(exe, new StringArray(args.toArray(new String[args.size()])));
throw new IOException("Failed to exec '"+exe+"' "+LIBC.strerror(Native.getLastError()));
}

Expand Down
3 changes: 2 additions & 1 deletion core/src/main/java/hudson/util/jna/GNUCLibrary.java
Expand Up @@ -55,7 +55,8 @@ public interface GNUCLibrary extends Library {
int chdir(String dir);
int getdtablesize();

int execv(String file, StringArray args);
int execv(String path, StringArray args);
int execvp(String file, StringArray args);
int setenv(String name, String value,int replace);
int unsetenv(String name);
void perror(String msg);
Expand Down

0 comments on commit c3ddea2

Please sign in to comment.