summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-01-10 06:37:43 +0000
committerflorian <florian@3c298f89-4303-0410-b956-a3cf2f4a3e73>2006-01-10 06:37:43 +0000
commit0ddcf656ddc08890ebccd5d21384c387b4d243e4 (patch)
tree5d2675a8af46029e13bd7ed1d9f99fa7491ed936
parentd1f90bbe86153b38df68f48c0f18854cc71bfae6 (diff)
Better handling of getpwnam and getgrnam for dhcp-forwarde
git-svn-id: svn://svn.openwrt.org/openwrt/trunk/openwrt@2868 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--package/dhcp-forwarder/patches/01-getpwnmam_getgrnam.patch35
1 files changed, 35 insertions, 0 deletions
diff --git a/package/dhcp-forwarder/patches/01-getpwnmam_getgrnam.patch b/package/dhcp-forwarder/patches/01-getpwnmam_getgrnam.patch
new file mode 100644
index 0000000000..ef84913302
--- /dev/null
+++ b/package/dhcp-forwarder/patches/01-getpwnmam_getgrnam.patch
@@ -0,0 +1,35 @@
+diff -pur dhcp-forwarder-0.7-orig/src/wrappers.h dhcp-forwarder-0.7-patched/src/wrappers.h
+--- dhcp-forwarder-0.7-orig/src/wrappers.h 2004-06-22 12:46:56.000000000 +0200
++++ dhcp-forwarder-0.7-patched/src/wrappers.h 2005-12-27 12:28:10.464289435 +0100
+@@ -65,7 +65,14 @@ Egetgrnam(char const *name)
+ /*@*/
+ {
+ /*@observer@*/struct group const *res = getgrnam(name);
+- FatalErrnoError(res==0, 1, "getgrnam()");
++
++ FatalErrnoError((res == NULL) && (errno != 0), 1, "getgrnam()");
++
++ if (res == NULL)
++ {
++ fprintf (stderr, "No such group: `%s'\n", name);
++ exit (1);
++ }
+
+ /*@-freshtrans@*/
+ /*@-mustfreefresh@*/
+@@ -80,7 +87,14 @@ Egetpwnam(char const *name)
+ /*@*/
+ {
+ struct passwd const *res = getpwnam(name);
+- FatalErrnoError(res==0, 1, "getpwnam()");
++
++ FatalErrnoError((res == NULL) && (errno != 0), 1, "getpwnam()");
++
++ if (res == NULL)
++ {
++ fprintf (stderr, "No such user: `%s'\n", name);
++ exit (1);
++ }
+
+ return res;
+ }