copy.c revision 355b59e252c9910e44a1ad95c045ba8db58a4f6a
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "util.h"
#include "copy.h"
for (;;) {
ssize_t n, k;
if (max_bytes <= 0)
return -E2BIG;
}
if (n < 0)
return -errno;
if (n == 0)
break;
errno = 0;
if (k < 0)
return k;
if (k != n)
max_bytes -= n;
}
}
return 0;
}
static int fd_copy_symlink(int df, const char *from, const struct stat *st, int dt, const char *to) {
int r;
if (r < 0)
return r;
return -errno;
return -errno;
return 0;
}
static int fd_copy_regular(int df, const char *from, const struct stat *st, int dt, const char *to) {
int r, q;
if (fdf < 0)
return -errno;
if (fdt < 0)
return -errno;
if (r < 0) {
return r;
}
r = -errno;
r = -errno;
fdt = -1;
if (q < 0) {
r = -errno;
}
return r;
}
int r;
if (r < 0)
return -errno;
r = -errno;
r = -errno;
return r;
}
int r;
if (r < 0)
return -errno;
r = -errno;
r = -errno;
return r;
}
static int fd_copy_directory(int df, const char *from, const struct stat *st, int dt, const char *to, dev_t original_device, bool merge) {
bool created;
int r;
if (fdf < 0)
return -errno;
if (!d)
return -errno;
fdf = -1;
if (r >= 0)
created = true;
created = false;
else
return -errno;
if (fdt < 0)
return -errno;
r = 0;
if (created) {
r = -errno;
r = -errno;
}
int q;
r = -errno;
continue;
}
continue;
else
q = -ENOTSUP;
q = 0;
if (q < 0)
r = q;
}
return r;
}
return -errno;
else
return -ENOTSUP;
}
int r;
if (fdf < 0)
return -errno;
if (fdt < 0)
return -errno;
if (r < 0) {
return r;
}
fdt = -1;
if (r < 0) {
r = -errno;
return r;
}
return 0;
}