tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: crontab(1) using stdin



On Thu, Oct 31, 2024 at 12:35:01AM +0100, Steffen Nurpmeso wrote:
> наб wrote in
>  <q2pxxf2jv42trd53f3vu6n6656i2oxsne4p4pefirzq52mru7j@tarta.nabijaczleweli\
>  .xyz>:
>  |You can still write this portably:
>  |  echo crontab > ./-
>  |  crontab - < -
>  |  rm -
>  |unideal, sure, but.
> OpenIndiana says
>   #?1|oi-2024:steffen$ crontab -
>   crontab: can't open your crontab file.
Regardless of the school this subscribes to it should work.

I tried to install openindiana to test but the images don't work,
but if it's similar to the illumos gate crontab then I don't see why it
wouldn't
        } else {
                if (argc == 0)
                        copycron(stdin);
                else if (seteuid(getuid()) != 0 || (fp = fopen(argv[0], "r"))
                    == NULL)
                        crabort(BADOPEN);
                else {
                        seteuid(0);
                        copycron(fp);
                }
        }
(BADOPEN is "can't open your crontab file.")

Beside something funny like, say, special - handling?
But unclear why the fopen would fail then or what it'd be.
What about... "crontab -- - < -"?

Attachment: signature.asc
Description: PGP signature



Home | Main Index | Thread Index | Old Index