summaryrefslogtreecommitdiff
path: root/src/basic
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2016-04-06 10:49:52 +0200
committerLennart Poettering <lennart@poettering.net>2016-04-06 10:49:52 +0200
commitd4337c15d5835c8eecf079bd5173f8b5c51727c7 (patch)
treef9cadf1f81c2fb7e2f8d6ff4752c45fdeb00624f /src/basic
parent056f0498fefc4c3e3cedf11ea3ba1b04a8694118 (diff)
parent6dfde7acf1405adbb7adb2adc6969c4eb3c0990a (diff)
Merge pull request #2944 from keszybz/man-coredump-sysctl
Man coredump sysctl
Diffstat (limited to 'src/basic')
-rw-r--r--src/basic/copy.c6
-rw-r--r--src/basic/parse-util.h12
2 files changed, 15 insertions, 3 deletions
diff --git a/src/basic/copy.c b/src/basic/copy.c
index 41dc8ca79a..e2db4be9ff 100644
--- a/src/basic/copy.c
+++ b/src/basic/copy.c
@@ -71,7 +71,7 @@ static ssize_t try_copy_file_range(int fd_in, loff_t *off_in,
int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink) {
bool try_cfr = true, try_sendfile = true, try_splice = true;
int r;
- size_t m = SSIZE_MAX; /* that the maximum that sendfile and c_f_r accept */
+ size_t m = SSIZE_MAX; /* that is the maximum that sendfile and c_f_r accept */
assert(fdf >= 0);
assert(fdt >= 0);
@@ -94,8 +94,8 @@ int copy_bytes(int fdf, int fdt, uint64_t max_bytes, bool try_reflink) {
if (max_bytes <= 0)
return 1; /* return > 0 if we hit the max_bytes limit */
- if ((uint64_t) m > max_bytes)
- m = (size_t) max_bytes;
+ if (m > max_bytes)
+ m = max_bytes;
}
/* First try copy_file_range(), unless we already tried */
diff --git a/src/basic/parse-util.h b/src/basic/parse-util.h
index d8dc26a36e..c407263e16 100644
--- a/src/basic/parse-util.h
+++ b/src/basic/parse-util.h
@@ -90,6 +90,18 @@ static inline int safe_atoli(const char *s, long int *ret_u) {
}
#endif
+#if SIZE_MAX == UINT_MAX
+static inline int safe_atozu(const char *s, size_t *ret_u) {
+ assert_cc(sizeof(size_t) == sizeof(unsigned));
+ return safe_atou(s, ret_u);
+}
+#else
+static inline int safe_atozu(const char *s, size_t *ret_u) {
+ assert_cc(sizeof(size_t) == sizeof(long unsigned));
+ return safe_atolu(s, ret_u);
+}
+#endif
+
int safe_atod(const char *s, double *ret_d);
int parse_fractional_part_u(const char **s, size_t digits, unsigned *res);