summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikola Pajkovsky <npajkovs@redhat.com>2010-08-25 16:22:07 +0200
committerNikola Pajkovsky <npajkovs@redhat.com>2010-08-25 16:22:33 +0200
commit7764bc0159f4a670293003539e2c8d9cccdcb41a (patch)
tree60d3f296692b043eff30842605a6935d1a54b25d
parent87ca5dda058c8fe6548835b357fad9b93a106045 (diff)
downloadabrt-7764bc0159f4a670293003539e2c8d9cccdcb41a.tar.gz
abrt-7764bc0159f4a670293003539e2c8d9cccdcb41a.tar.xz
abrt-7764bc0159f4a670293003539e2c8d9cccdcb41a.zip
copyfd.cpp -> copyfd.c
Signed-off-by: Nikola Pajkovsky <npajkovs@redhat.com>
-rw-r--r--inc/abrtlib.h17
-rw-r--r--lib/utils/Makefile.am2
-rw-r--r--lib/utils/copyfd.c (renamed from lib/utils/copyfd.cpp)17
3 files changed, 19 insertions, 17 deletions
diff --git a/inc/abrtlib.h b/inc/abrtlib.h
index 31c62bee..5df598f4 100644
--- a/inc/abrtlib.h
+++ b/inc/abrtlib.h
@@ -67,6 +67,10 @@ int vdprintf(int d, const char *format, va_list ap);
#include "read_write.h"
+/* copyfd_XX print read/write errors and return -1 if they occur */
+enum {
+ COPYFD_SPARSE = 1 << 0,
+};
#ifdef __cplusplus
extern "C" {
#endif
@@ -76,6 +80,10 @@ char *concat_path_file(const char *path, const char *filename);
char *append_to_malloced_string(char *mstr, const char *append);
char* skip_whitespace(const char *s);
char* skip_non_whitespace(const char *s);
+off_t copyfd_eof(int src_fd, int dst_fd, int flags);
+off_t copyfd_size(int src_fd, int dst_fd, off_t size, int flags);
+void copyfd_exact_size(int src_fd, int dst_fd, off_t size);
+off_t copy_file(const char *src_name, const char *dst_name, int mode);
#ifdef __cplusplus
}
#endif
@@ -90,15 +98,6 @@ int xatoi(const char *numstr);
int xatoi_u(const char *numstr);
-/* copyfd_XX print read/write errors and return -1 if they occur */
-enum {
- COPYFD_SPARSE = 1 << 0,
-};
-off_t copyfd_eof(int src_fd, int dst_fd, int flags);
-off_t copyfd_size(int src_fd, int dst_fd, off_t size, int flags);
-void copyfd_exact_size(int src_fd, int dst_fd, off_t size);
-off_t copy_file(const char *src_name, const char *dst_name, int mode);
-
enum {
EXECFLG_INPUT = 1 << 0,
EXECFLG_OUTPUT = 1 << 1,
diff --git a/lib/utils/Makefile.am b/lib/utils/Makefile.am
index e1b41d65..e5902ec3 100644
--- a/lib/utils/Makefile.am
+++ b/lib/utils/Makefile.am
@@ -16,7 +16,7 @@ libABRTUtils_la_SOURCES = \
encbase64.cpp \
read_write.c read_write.h \
logging.c logging.h \
- copyfd.cpp \
+ copyfd.c \
daemon.cpp \
skip_whitespace.c \
xatonum.cpp numtoa.cpp \
diff --git a/lib/utils/copyfd.cpp b/lib/utils/copyfd.c
index 61acc479..1e6e43b8 100644
--- a/lib/utils/copyfd.cpp
+++ b/lib/utils/copyfd.c
@@ -23,13 +23,14 @@
*/
#include "abrtlib.h"
+#include "read_write.h"
#define CONFIG_FEATURE_COPYBUF_KB 4
static const char msg_write_error[] = "write error";
static const char msg_read_error[] = "read error";
-static off_t full_fd_action(int src_fd, int dst_fd, off_t size, int flags = 0)
+static off_t full_fd_action(int src_fd, int dst_fd, off_t size, int flags)
{
int status = -1;
off_t total = 0;
@@ -97,12 +98,14 @@ static off_t full_fd_action(int src_fd, int dst_fd, off_t size, int flags = 0)
last_was_seek = 1;
} else {
need2write:
- ssize_t wr = full_write(dst_fd, buffer, rd);
- if (wr < rd) {
- perror_msg("%s", msg_write_error);
- break;
- }
- last_was_seek = 0;
+ {
+ ssize_t wr = full_write(dst_fd, buffer, rd);
+ if (wr < rd) {
+ perror_msg("%s", msg_write_error);
+ break;
+ }
+ last_was_seek = 0;
+ }
}
}
total += rd;