Re: [PATCH v2] gc: use temporary file for editing crontab
- From
Renato Botelho <garga@freebsd.org>
- Date
- Aug 29, 2022, 10:52 UTC
- Message-ID
- <d2b63f68-4463-63cd-065f-0902fc8be4e3@FreeBSD.org>
- In-Reply-To
- <20220828214143.754759-1-sandals@crustytoothpaste.net>
On 28/08/22 18:41, brian m. carlson wrote:
Show 17 quoted lines
> While cron is specified by POSIX, there are a wide variety of > implementations in use. On FreeBSD, the cron implementation requires a > file name argument: if the user wants to edit standard input, they must > specify "-". However, this notation is not specified by POSIX, allowing > the possibility that making such a change may break other, less common > implementations. > > Since POSIX tells us that cron must accept a file name argument, let's > solve this problem by specifying a temporary file instead. This will > ensure that we work with the vast majority of implementations. > > Note that because delete_tempfile closes the file for us, we should not > call fclose here on the handle, since doing so will introduce a double > free. > > Reported-by: Renato Botelho <garga@FreeBSD.org> > Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
brian,
I've tested and confirmed this fix works as expected. This patch is now applied on FreeBSD ports tree.
Thanks!
-- Renato Botelho