files.c revision 06247775aa9c49ffce72827921eb45e2d04c6aa1
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Jakub Hrozek <jhrozek@redhat.com>
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin Copyright (C) 2009 Red Hat
7c2fbfb345896881c631598ee3852ce9ce33fb07April Chin This program is free software; you can redistribute it and/or modify
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin it under the terms of the GNU General Public License as published by
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin the Free Software Foundation; either version 3 of the License, or
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin (at your option) any later version.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin This program is distributed in the hope that it will be useful,
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin but WITHOUT ANY WARRANTY; without even the implied warranty of
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin GNU General Public License for more details.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin You should have received a copy of the GNU General Public License
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin along with this program. If not, see <http://www.gnu.org/licenses/>.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * This file incorporates work covered by the following copyright and
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * permission notice:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 1991 - 1994, Julianne Frances Haugh
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 1996 - 2001, Marek Michałkiewicz
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 2003 - 2006, Tomasz Kłoczko
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Copyright (c) 2007 - 2008, Nicolas François
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * All rights reserved.
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * Redistribution and use in source and binary forms, with or without
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * modification, are permitted provided that the following conditions
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * are met:
da2e3ebdc1edfbc5028edf1354e7dd2fa69a7968chin * 1. Redistributions of source code must retain the above copyright
#include <dirent.h>
#include <fcntl.h>
#include <errno.h>
#include <talloc.h>
#include "config.h"
#include "tools/tools_util.h"
struct copy_ctx {
const char *src_orig;
const char *dst_orig;
const char *root);
int ret;
if (!tmp_ctx) {
return ENOMEM;
return ret;
const char *root)
int ret;
goto fail;
goto fail;
if (ret != 0) {
goto fail;
goto fail;
goto fail;
if (ret != 0) {
goto fail;
if (ret != 0) {
goto fail;
if (ret != 0) {
goto fail;
fail:
return ret;
int ret = 0;
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
return EOK;
char *buffer;
if (!buffer) {
return NULL;
if (nchars < 0) {
return NULL;
if (!buffer) {
return NULL;
return buffer;
const char *src,
const char *dst,
int ret;
char *oldlink;
char *tmp;
if (!tmp_ctx) {
return ENOMEM;
goto done;
goto done;
if (ret != 0) {
goto done;
if (ret != 0) {
goto done;
done:
return ret;
int ret = 0;
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
if (ret != 0) {
return ret;
return EOK;
const char *dst,
int ret;
if (ifd < 0) {
goto fail;
if (ret != 0) {
goto fail;
goto fail;
if (ofd < 0) {
goto fail;
if (ret != 0) {
goto fail;
if (ret != 0) {
goto fail;
goto fail;
else if (cnt > 0) {
written = 0;
goto fail;
else if (res <= 0) {
goto fail;
goto fail;
if (ret != 0) {
goto fail;
if (ret != 0) {
goto fail;
if (ret != 0) {
goto fail;
return EOK;
fail:
return ret;
const char *src,
const char *dst,
return ret;
return ret;
return EOK;
return ret;
const char *src_root,
const char *dst_root,
int ret;
goto fail;
goto fail;
goto fail;
if (ret != 0) {
goto fail;
fail:
return ret;
if (ret != 0) {
goto fail;
goto fail;
fail:
return ret;