backup_file.c revision 4f6a396fcf16f97b2abc3d0cba10e9aa9bc38619
/*
SSSD
Backup files
Copyright (C) Simo Sorce 2009
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <fcntl.h>
#include <stddef.h>
#include <stdlib.h>
#define BUFFER_SIZE 65536
{
char buf[BUFFER_SIZE];
int src_fd = -1;
int dst_fd = -1;
char *dst_file;
int ret, i;
if (src_fd < 0) {
goto done;
}
if (!tmp_ctx) {
goto done;
}
/* try a few times to come up with a new backup file, then give up */
for (i = 0; i < 10; i++) {
if (i == 0) {
} else {
}
if (!dst_file) {
goto done;
}
errno = 0;
if (dst_fd > 0) break;
goto done;
}
}
if (ret != 0) {
goto done;
}
/* copy file contents */
while (1) {
if (num < 0) {
goto done;
}
if (num == 0) break;
pos = 0;
while (count > 0) {
errno = 0;
if (num < 0) {
goto done;
}
}
}
done:
return ret;
}