file.c revision dafcb997e390efa4423883dafd100c975c4095d6
206a2ec1714a36057227ad8ebafd23cd4972f21fMark Andrews * Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC")
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * Copyright (C) 2000-2002 Internet Software Consortium.
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * Permission to use, copy, modify, and distribute this software for any
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * purpose with or without fee is hereby granted, provided that the above
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * copyright notice and this permission notice appear in all copies.
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
393fd55d91306e6def3a3d06748eee031f57bd17Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
0d88065af34e10d7695680ca48f0d2ab2aa0aa32Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
0d88065af34e10d7695680ca48f0d2ab2aa0aa32Mark Andrews * Portions Copyright (c) 1987, 1993
a846a36bdec99f266170cf7d4dac87081a3055baMark Andrews * The Regents of the University of California. All rights reserved.
a846a36bdec99f266170cf7d4dac87081a3055baMark Andrews * Redistribution and use in source and binary forms, with or without
0d88065af34e10d7695680ca48f0d2ab2aa0aa32Mark Andrews * modification, are permitted provided that the following conditions
f89ccd99a4c1f3fa8e0d610463fb9afad4174c5cMark Andrews * 1. Redistributions of source code must retain the above copyright
a846a36bdec99f266170cf7d4dac87081a3055baMark Andrews * notice, this list of conditions and the following disclaimer.
a846a36bdec99f266170cf7d4dac87081a3055baMark Andrews * 2. Redistributions in binary form must reproduce the above copyright
a846a36bdec99f266170cf7d4dac87081a3055baMark Andrews * notice, this list of conditions and the following disclaimer in the
f89ccd99a4c1f3fa8e0d610463fb9afad4174c5cMark Andrews * documentation and/or other materials provided with the distribution.
f89ccd99a4c1f3fa8e0d610463fb9afad4174c5cMark Andrews * 3. All advertising materials mentioning features or use of this software
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * must display the following acknowledgement:
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * This product includes software developed by the University of
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * California, Berkeley and its contributors.
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * 4. Neither the name of the University nor the names of its contributors
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * may be used to endorse or promote products derived from this software
88a44b0542f5544bc2c29ed64540e4ddfe6eed87Mark Andrews * without specific prior written permission.
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
a963386d02b0b21d26a50fce1ef442602c81377bMark Andrews * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews * SUCH DAMAGE.
9a2a12db5a179ff7b9711a0c035036223f6fae79Mark Andrews/* $Id: file.c,v 1.46 2004/03/05 05:11:44 marka Exp $ */
206a2ec1714a36057227ad8ebafd23cd4972f21fMark Andrews#include <time.h> /* Required for utimes on some platforms. */
9213ea3cec20ddb6a305f4d877b75eaa8100c02dMark Andrews#include <unistd.h> /* Required for mkstemp on NetBSD. */
#include "errno2result.h"
static isc_result_t
return (result);
return (result);
return (ISC_R_RANGE);
return (ISC_R_SUCCESS);
if (s != NULL)
if (s != NULL) {
return (ISC_R_NOSPACE);
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
static char alphnum[] =
char *cp;
cp++;
return (ISC_R_FAILURE);
x = cp--;
x = cp--;
for (cp = x;;) {
return (ISC_R_FAILURE);
*cp = *t;
return (ISC_R_SUCCESS);
int fd;
FILE *f;
char *cp;
int mode;
cp++;
return (ISC_R_FAILURE);
x = cp--;
x = cp--;
for (cp = x;;) {
return (ISC_R_FAILURE);
*cp = *t;
if (f == NULL) {
*fp = f;
return (result);
return (ISC_R_SUCCESS);
return (ISC_R_SUCCESS);
return (ISC_TRUE);
return (ISC_TRUE);
return (ISC_FALSE);
if (s == NULL)
return (filename);
const char *base;
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
static isc_result_t
char *cwd;
return (result);
return (result);
return (ISC_R_NOSPACE);
return (ISC_R_SUCCESS);
return (result);