summaryrefslogtreecommitdiffstats
path: root/libtar/getservbyname_r.c
diff options
context:
space:
mode:
authorbigbiff bigbiff <bigbiff@teamw.in>2013-01-09 15:09:08 +0100
committerbigbiff bigbiff <bigbiff@teamw.in>2013-01-09 15:09:08 +0100
commit9c754053b07a724bdd98d039f34899d6a49115b7 (patch)
tree464885db361a12d83d60cf152142c765562bb92d /libtar/getservbyname_r.c
parentAdd Samsung TouchWiz decryption (diff)
downloadandroid_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.gz
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.bz2
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.lz
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.xz
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.tar.zst
android_bootable_recovery-9c754053b07a724bdd98d039f34899d6a49115b7.zip
Diffstat (limited to 'libtar/getservbyname_r.c')
-rw-r--r--libtar/getservbyname_r.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/libtar/getservbyname_r.c b/libtar/getservbyname_r.c
new file mode 100644
index 000000000..e386bc9f6
--- /dev/null
+++ b/libtar/getservbyname_r.c
@@ -0,0 +1,41 @@
+/*
+** Copyright 2002 University of Illinois Board of Trustees
+** Copyright 2002 Mark D. Roth
+** All rights reserved.
+**
+** getservbyname_r.c - getservbyname_r() function for compatibility library
+**
+** Mark D. Roth <roth@uiuc.edu>
+** Campus Information Technologies and Educational Services
+** University of Illinois at Urbana-Champaign
+*/
+
+#include <config.h>
+
+#include <stdio.h>
+#include <sys/types.h>
+#include <netdb.h>
+
+
+int
+compat_getservbyname_r(const char *name, const char *proto,
+ struct servent *sp, char *buf, size_t buflen,
+ struct servent **spp)
+{
+#if GETSERVBYNAME_R_NUM_ARGS == 5
+ *spp = getservbyname_r(name, proto, sp, buf, buflen);
+
+ if (*spp == NULL)
+ return -1;
+ return 0;
+#elif GETSERVBYNAME_R_NUM_ARGS == 4
+ struct servent_data sdata;
+
+ if (getservbyname_r(name, proto, sp, &sdata) == -1)
+ return -1;
+ *spp = sp;
+ return 0;
+#endif /* GETSERVBYNAME_R_NUM_ARGS == 5 */
+}
+
+