diff options
author | Erik Troan <ewt@redhat.com> | 2001-06-20 01:53:47 +0000 |
---|---|---|
committer | Erik Troan <ewt@redhat.com> | 2001-06-20 01:53:47 +0000 |
commit | b3cbb577dbe4ecda19f50f9b297b9c3e23a7a951 (patch) | |
tree | 689b6e27ac9fc7b6b1c3209ca60c8fae4190e85f /loader/misc.c | |
parent | 0dd8714cdfddff257b075afb37e5001f9c81f64c (diff) | |
download | anaconda-b3cbb577dbe4ecda19f50f9b297b9c3e23a7a951.tar.gz anaconda-b3cbb577dbe4ecda19f50f9b297b9c3e23a7a951.tar.xz anaconda-b3cbb577dbe4ecda19f50f9b297b9c3e23a7a951.zip |
merge from (now defunct) anaconda-dispatch branch
added telnet server support (not turned on) along with support for cramfs'd
files in many places
Diffstat (limited to 'loader/misc.c')
-rw-r--r-- | loader/misc.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/loader/misc.c b/loader/misc.c index 776520a0e..13f727a04 100644 --- a/loader/misc.c +++ b/loader/misc.c @@ -5,19 +5,15 @@ #include "log.h" -int copyFile(char * source, char * dest) { - int infd = -1, outfd = -1; +int copyFileFd(int infd, char * dest) { + int outfd; char buf[4096]; int i; int rc = 0; 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)); - return 1; - } else if (outfd < 0) { + if (outfd < 0) { close(infd); logMessage("failed to open %s: %s", dest, strerror(errno)); return 1; @@ -30,12 +26,29 @@ int copyFile(char * source, char * dest) { } } - close(infd); close(outfd); return rc; } +int copyFile(char * source, char * dest) { + int infd = -1; + int rc; + + infd = open(source, O_RDONLY); + + if (infd < 0) { + logMessage("failed to open %s: %s", source, strerror(errno)); + return 1; + } + + rc = copyFileFd(infd, dest); + + close(infd); + + return rc; +} + char * readLine(FILE * f) { char buf[1024]; |