dovecot-2.2: lib: Added str_to_ino()
dovecot at dovecot.org
dovecot at dovecot.org
Mon Aug 31 20:26:09 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/9dd0f155731c
changeset: 19051:9dd0f155731c
user: Timo Sirainen <tss at iki.fi>
date: Mon Aug 31 23:25:12 2015 +0300
description:
lib: Added str_to_ino()
diffstat:
src/lib/strnum.c | 13 +++++++++++++
src/lib/strnum.h | 3 +++
2 files changed, 16 insertions(+), 0 deletions(-)
diffs (36 lines):
diff -r 238a34ad1ab0 -r 9dd0f155731c src/lib/strnum.c
--- a/src/lib/strnum.c Mon Aug 31 23:11:17 2015 +0300
+++ b/src/lib/strnum.c Mon Aug 31 23:25:12 2015 +0300
@@ -387,6 +387,19 @@
return 0;
}
+int str_to_ino(const char *str, ino_t *num_r)
+{
+ uintmax_t l;
+
+ if (str_to_uintmax(str, &l) < 0)
+ return -1;
+
+ if (verify_xid(l, sizeof(*num_r)) < 0)
+ return -1;
+ *num_r = (ino_t)l;
+ return 0;
+}
+
int str_to_uoff(const char *str, uoff_t *num_r)
{
uintmax_t l;
diff -r 238a34ad1ab0 -r 9dd0f155731c src/lib/strnum.h
--- a/src/lib/strnum.h Mon Aug 31 23:11:17 2015 +0300
+++ b/src/lib/strnum.h Mon Aug 31 23:25:12 2015 +0300
@@ -161,6 +161,9 @@
int str_to_pid(const char *str, pid_t *num_r)
ATTR_WARN_UNUSED_RESULT;
+int str_to_ino(const char *str, ino_t *num_r)
+ ATTR_WARN_UNUSED_RESULT;
+
int str_to_uoff(const char *str, uoff_t *num_r)
ATTR_WARN_UNUSED_RESULT;
int str_parse_uoff(const char *str, uoff_t *num_r,
More information about the dovecot-cvs
mailing list