summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-01-24 09:27:42 +0200
committerToomas Soome <tsoome@me.com>2019-07-09 08:45:05 +0300
commit19803d096124c0f1ca62906eb328234556bfad35 (patch)
treea91f4ee3153100011c3e56b4ff05fcfe8ca6e23d
parenta3ab7e857d66d206fcfc56f9a628266bd25a7bd0 (diff)
downloadillumos-joyent-19803d096124c0f1ca62906eb328234556bfad35.tar.gz
11303 cron: NULL pointer errors
Reviewed by: Garrett D'Amore <garrett@damore.org> Approved by: Dan McDonald <danmcd@joyent.com>
-rw-r--r--usr/src/cmd/cron/cron.c12
-rw-r--r--usr/src/cmd/cron/crontab.c20
2 files changed, 14 insertions, 18 deletions
diff --git a/usr/src/cmd/cron/cron.c b/usr/src/cmd/cron/cron.c
index 55df389cd7..a803c1cc70 100644
--- a/usr/src/cmd/cron/cron.c
+++ b/usr/src/cmd/cron/cron.c
@@ -29,7 +29,7 @@
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
/* Copyright (c) 1987, 1988 Microsoft Corporation */
/* All Rights Reserved */
@@ -1167,7 +1167,7 @@ readcron(struct usr *u, time_t reftime)
if (strncmp(&line[cursor], ENV_TZ,
strlen(ENV_TZ)) == 0) {
if ((tmp = strchr(&line[cursor], '\n')) != NULL) {
- *tmp = NULL;
+ *tmp = '\0';
}
if (!isvalid_tz(&line[cursor + strlen(ENV_TZ)], NULL,
@@ -1185,7 +1185,7 @@ readcron(struct usr *u, time_t reftime)
if (strncmp(&line[cursor], ENV_HOME,
strlen(ENV_HOME)) == 0) {
if ((tmp = strchr(&line[cursor], '\n')) != NULL) {
- *tmp = NULL;
+ *tmp = '\0';
}
if (home == NULL ||
strcmp(&line[cursor], get_obj(home))) {
@@ -1199,7 +1199,7 @@ readcron(struct usr *u, time_t reftime)
if (strncmp(&line[cursor], ENV_SHELL,
strlen(ENV_SHELL)) == 0) {
if ((tmp = strchr(&line[cursor], '\n')) != NULL) {
- *tmp = NULL;
+ *tmp = '\0';
}
if (shell == NULL ||
strcmp(&line[cursor], get_obj(shell))) {
@@ -2839,7 +2839,7 @@ msg_wait(long tim)
static void
process_msg(struct message *pmsg, time_t reftime)
{
- if (pmsg->etype == NULL)
+ if (pmsg->etype == 0)
return;
switch (pmsg->etype) {
@@ -3616,7 +3616,7 @@ contract_abandon_latest(pid_t pid)
static struct shared *
create_shared(void *obj, void * (*obj_alloc)(void *obj),
- void (*obj_free)(void *))
+ void (*obj_free)(void *))
{
struct shared *out;
diff --git a/usr/src/cmd/cron/crontab.c b/usr/src/cmd/cron/crontab.c
index 327a71388b..88302f8bd7 100644
--- a/usr/src/cmd/cron/crontab.c
+++ b/usr/src/cmd/cron/crontab.c
@@ -23,7 +23,7 @@
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
-/* All Rights Reserved */
+/* All Rights Reserved */
#include <sys/types.h>
@@ -405,8 +405,7 @@ main(int argc, char **argv)
}
static void
-copycron(fp)
-FILE *fp;
+copycron(FILE *fp)
{
FILE *tfp;
char pid[6], *tnam_end;
@@ -446,7 +445,7 @@ FILE *fp;
strncpy(buf, &line[cursor + strlen(ENV_TZ)],
sizeof (buf));
if ((x = strchr(buf, '\n')) != NULL)
- *x = NULL;
+ *x = '\0';
if (isvalid_tz(buf, NULL, _VTZ_ALL)) {
goto cont;
@@ -462,7 +461,7 @@ FILE *fp;
strncpy(buf, &line[cursor + strlen(ENV_SHELL)],
sizeof (buf));
if ((x = strchr(buf, '\n')) != NULL)
- *x = NULL;
+ *x = '\0';
if (isvalid_shell(buf)) {
goto cont;
@@ -478,7 +477,7 @@ FILE *fp;
strncpy(buf, &line[cursor + strlen(ENV_HOME)],
sizeof (buf));
if ((x = strchr(buf, '\n')) != NULL)
- *x = NULL;
+ *x = '\0';
if (chdir(buf) == 0) {
goto cont;
} else {
@@ -524,8 +523,7 @@ cont:
}
static int
-next_field(lower, upper)
-int lower, upper;
+next_field(int lower, int upper)
{
int num, num2;
@@ -583,8 +581,7 @@ int lower, upper;
}
static void
-cerror(msg)
-char *msg;
+cerror(char *msg)
{
fprintf(stderr, gettext("%scrontab: error on previous line; %s\n"),
line, msg);
@@ -600,8 +597,7 @@ catch(int x)
}
static void
-crabort(msg)
-char *msg;
+crabort(char *msg)
{
int sverrno;