diff options
author | Erik Troan <ewt@redhat.com> | 1999-09-18 16:11:13 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 1999-09-18 16:11:13 +0000 |
commit | e6f692d2ca3c95d0b86253a473c0acf21ce69bcb (patch) | |
tree | c8ad006e31dab674855db21c8366122e3d5f83b5 /loader | |
parent | a7db59806d95e72102fb0601216ca481f5d4a380 (diff) | |
download | anaconda-e6f692d2ca3c95d0b86253a473c0acf21ce69bcb.tar.gz anaconda-e6f692d2ca3c95d0b86253a473c0acf21ce69bcb.tar.xz anaconda-e6f692d2ca3c95d0b86253a473c0acf21ce69bcb.zip |
*** empty log message ***
Diffstat (limited to 'loader')
-rw-r--r-- | loader/misc.c | 29 | ||||
-rw-r--r-- | loader/misc.h | 6 |
2 files changed, 35 insertions, 0 deletions
diff --git a/loader/misc.c b/loader/misc.c new file mode 100644 index 000000000..c811e669e --- /dev/null +++ b/loader/misc.c @@ -0,0 +1,29 @@ +#include <errno.h> +#include <fcntl.h> +#include <string.h> +#include <unistd.h> + +#include "log.h" + +int copyFile(char * source, char * dest) { + int infd = -1, outfd = -1; + char buf[4096]; + int i; + + outfd = open(dest, O_CREAT | O_RDWR, 0666); + infd = open(source, O_RDONLY); + + if (infd < 0) { + logMessage("failed to open %s: %s", source, strerror(errno)); + } + + while ((i = read(infd, buf, sizeof(buf))) > 0) { + if (write(outfd, buf, i) != i) break; + } + + close(infd); + close(outfd); + + return 0; +} + diff --git a/loader/misc.h b/loader/misc.h new file mode 100644 index 000000000..2d29534d6 --- /dev/null +++ b/loader/misc.h @@ -0,0 +1,6 @@ +#ifndef H_LOADER_MISC_H +#define H_LOADER_MISC_H + +int copyFile(char * source, char * dest); + +#endif |