DragonFly BSD
DragonFly bugs List (threaded) for 2004-11
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ntpd.conf


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Sat, 13 Nov 2004 12:01:30 -0800 (PST)

:On Sat, Nov 13, 2004 at 04:08:29PM +0100, Joerg Anslik wrote:
:> No, it's still V1.2, even after a fresh buildworld/installworld. I
:> guess it's not overwritten because I made changes to the file...?
:
:/etc is generally NOT updated by buildworld/installworld. Just remove
:all files from /etc/rc.d and run "make install" from src/etc/rc.d.
:We should really think about etcmerge :)
:
:Joerg

    Ick.  no mergemaster clone, please! :-)

    I'd like to formalize the /etc/defaults/blah arrangement that we
    already have for other things.

    rcfile = getstdrcfile("ntpd.conf");

	If "/etc/<filename>" exists that is the path returned.

	Otherwise if "/etc/defaults/<filename>" exists that is the path
	returned

	Otherwise "/etc/<filename>" is the patch returned (so when the failure
	occurs the program doesn't report a path that confuses the sysop).

    char *
    getstdrcfile(const char *path)
    {
	char *path1;
	char *path2;
	struct stat st;

	/*
	 * Absolute paths are not translated.
	 */
	if (path[0] == '/')
		return (strdup(path));

	/*
	 * If /etc/<path> exists return that.
	 */
	if (asprintf(&path1, "/etc/%s", path) < 0)
		return (NULL);
	if (stat(path1, &st) == 0)
		return (path1);

	/*
	 * If /etc/defaults/<path> exists return that.
	 */
	if (asprintf(&path2, "/etc/defaults/%s", path) < 0) {
		free(path1);
		return (NULL);
	}
	if (stat(path2, &st) == 0) {
		free(path1);
		return (path2);
	}

	/*
	 * If nothing works return the expected /etc/%s path so the utility
	 * can try to open its rc file, fail, and report a reasonable path.
	 */
	free(path2);
	return (path1);
    }

					-Matt
					Matthew Dillon 
					<dillon@xxxxxxxxxxxxx>



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