[illumos-Developer] webrev: 374 cron should send more useful mail

Garrett D'Amore garrett at nexenta.com
Mon Oct 25 22:45:29 PDT 2010


General review feedback:

cron.c: line 1211.  No need to use strncmp since the 3rd argument is
just strlen().  strcmp() will automatically terminate when hitting a
null byte anyway.

line 2250: why not just use strdup().  (What does xmalloc offer?  I need
to investigate further.)

line 1292, 1293: given the release at 1305, what's the point of this
release?

Generally it looks ok, but I need to spend more time looking carefully
at this "shared" memory allocation.

cronta.c: line 503.  Should this be wrapped with gettext()?  I've not
looked at the other output messages for crontab.

line 491: again, strcmp() is sufficient.

line 495: shouldn't you cast strncpy() to void?

line 503: ditto fprintf().

	- Garrett


On Tue, 2010-10-26 at 12:32 +1100, Joshua M. Clulow wrote:
> On Tue, Oct 26, 2010 at 9:51 AM, Joshua M. Clulow <josh at sysmgr.org> wrote:
> >  X-Cron-User: leftwing
> >  X-Cron-Host: thor
> >  X-Cron-Job-Name: command OR at job number
> >  X-Cron-Job-Type: cron OR at
> 
> New webrev:  http://cr.illumos.org/view/bf1fep9g/
> 
> New headers are in -- diff from previous webrev:
> 
> diff -r 198eec481a5b -r b06baa179835 usr/src/cmd/cron/cron.c
> --- a/usr/src/cmd/cron/cron.c   Tue Oct 26 04:09:26 2010 -0700
> +++ b/usr/src/cmd/cron/cron.c   Mon Oct 25 14:27:16 2010 -0700
> @@ -2755,13 +2755,7 @@
>         if (mailpipe == NULL)
>                 exit(127);
>         (void) fprintf(mailpipe, "To: %s\n", p->name);
> +       (void) fprintf(mailpipe, "X-Mailer: cron (%s %s)\n", name.sysname,
> +           name.release);
> +       (void) fprintf(mailpipe, "X-Cron-User: %s\n", p->name);
> +       (void) fprintf(mailpipe, "X-Cron-Host: %s\n", name.nodename);
> +       (void) fprintf(mailpipe, "X-Cron-Job-Name: %s\n", pr->jobname);
>         if (pr->jobtype == CRONEVENT) {
> +               (void) fprintf(mailpipe, "X-Cron-Job-Type: cron\n");
>                 if (pr->subject != NULL) {
>                         (void) fprintf(mailpipe, "Subject: %s\n\n",
>                             pr->subject);
> @@ -2776,7 +2770,6 @@
>                         (void) fprintf(mailpipe, "%s\n\n", pr->jobname);
>                 }
>         } else {
> +               (void) fprintf(mailpipe, "X-Cron-Job-Type: at\n");
>                 (void) fprintf(mailpipe, "Subject: Output from \"at\" job\n\n");
>                 (void) fprintf(mailpipe, "Your \"at\" job on %s\n",
>                     name.nodename);
> 
> 




More information about the Developer mailing list