diff options
author | znerd <znerd@FreeBSD.org> | 2002-04-04 04:42:07 +0800 |
---|---|---|
committer | znerd <znerd@FreeBSD.org> | 2002-04-04 04:42:07 +0800 |
commit | 207bb19cb500656b547ced4ffca819320c048d65 (patch) | |
tree | dffe9219ec411eee9aac4d9b8bb790b79e398489 /www/tomcat41 | |
parent | 0198741ea852d631634bc1285aadcbeae298e7b7 (diff) | |
download | freebsd-ports-gnome-207bb19cb500656b547ced4ffca819320c048d65.tar.gz freebsd-ports-gnome-207bb19cb500656b547ced4ffca819320c048d65.tar.zst freebsd-ports-gnome-207bb19cb500656b547ced4ffca819320c048d65.zip |
Now checking for the Java VM too in the control
program. Bumped PORTREVISION.
Diffstat (limited to 'www/tomcat41')
-rw-r--r-- | www/tomcat41/Makefile | 1 | ||||
-rw-r--r-- | www/tomcat41/files/daemonctl.c | 46 |
2 files changed, 44 insertions, 3 deletions
diff --git a/www/tomcat41/Makefile b/www/tomcat41/Makefile index c68de1e366fb..77019497c12c 100644 --- a/www/tomcat41/Makefile +++ b/www/tomcat41/Makefile @@ -7,6 +7,7 @@ PORTNAME= jakarta-tomcat PORTVERSION= 4.0.3 +PORTREVISION= 1 CATEGORIES= www java MASTER_SITES= http://jakarta.apache.org/builds/jakarta-tomcat-4.0/release/v${PORTVERSION}/bin/ \ http://www.metaverse.nl/~ernst/ \ diff --git a/www/tomcat41/files/daemonctl.c b/www/tomcat41/files/daemonctl.c index 49a45728ac74..a8b09bfb79b1 100644 --- a/www/tomcat41/files/daemonctl.c +++ b/www/tomcat41/files/daemonctl.c @@ -4,7 +4,7 @@ * * Daemon control program. * - * $FreeBSD: /tmp/pcvs/ports/www/tomcat41/files/Attic/daemonctl.c,v 1.2 2002-04-03 19:49:27 znerd Exp $ + * $FreeBSD: /tmp/pcvs/ports/www/tomcat41/files/Attic/daemonctl.c,v 1.3 2002-04-03 20:42:07 znerd Exp $ */ #include <assert.h> @@ -17,10 +17,11 @@ #include <syslog.h> #include <unistd.h> #include <sys/errno.h> +#include <sys/stat.h> #include <sys/types.h> #include <sys/uio.h> -#define MAX_FILE_SIZE 32 +#define MAX_FILE_SIZE 32 #define ERR_ILLEGAL_ARGUMENT 1 #define ERR_PID_FILE_NOT_FOUND 2 @@ -33,6 +34,11 @@ #define ERR_STDOUT_LOGFILE_OPEN 9 #define ERR_STDERR_LOGFILE_OPEN 10 #define ERR_FORK_FAILED 11 +#define ERR_STAT_JAVA_HOME 12 +#define ERR_JAVA_HOME_NOT_DIR 13 +#define ERR_STAT_JAVA_CMD 14 +#define ERR_JAVA_CMD_NOT_FILE 15 +#define ERR_JAVA_CMD_NOT_EXECUTABLE 16 #define private static @@ -236,6 +242,7 @@ void start(void) { int result; int stdoutLogFile; int stderrLogFile; + struct stat sb; /* Open and read the PID file */ file = openPIDFile(); @@ -255,7 +262,40 @@ void start(void) { printf(" [ DONE ]\n"); - /* XXX: printf(">> Checking for Java VM..."); */ + printf(">> Checking for Java VM..."); + result = stat("%%JAVA_HOME%%", &sb); + if (result != 0) { + printf(" [ FAILED ]\n"); + fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%: "); + perror(NULL); + exit(ERR_STAT_JAVA_HOME); + } + if (!S_ISDIR(sb.st_mode)) { + printf(" [ FAILED ]\n"); + fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java home directory %%JAVA_HOME%% is not a directory.\n"); + exit(ERR_JAVA_HOME_NOT_DIR); + } + + result = stat("%%JAVA_HOME%%/%%JAVA_CMD%%", &sb); + if (result != 0) { + printf(" [ FAILED ]\n"); + fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Unable to stat %%JAVA_HOME%%/%%JAVA_CMD%%: "); + perror(NULL); + exit(ERR_STAT_JAVA_CMD); + } + if (!S_ISREG(sb.st_mode)) { + printf(" [ FAILED ]\n"); + fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not a regular file.\n"); + exit(ERR_JAVA_CMD_NOT_FILE); + } + result = access("%%JAVA_HOME%%/%%JAVA_CMD%%", X_OK); + if (result != 0) { + printf(" [ FAILED ]\n"); + fprintf(stderr, "%%CONTROL_SCRIPT_NAME%%: Java command %%JAVA_HOME%%/%%JAVA_CMD%% is not executable: "); + perror(NULL); + exit(ERR_JAVA_CMD_NOT_EXECUTABLE); + } + printf(" [ DONE ]\n"); printf(">> Starting %%APP_TITLE%%..."); |