01-getpwnmam_getgrnam.patch 980 B

1234567891011121314151617181920212223242526272829303132333435
  1. diff -pur dhcp-forwarder-0.7-orig/src/wrappers.h dhcp-forwarder-0.7-patched/src/wrappers.h
  2. --- dhcp-forwarder-0.7-orig/src/wrappers.h 2004-06-22 12:46:56.000000000 +0200
  3. +++ dhcp-forwarder-0.7-patched/src/wrappers.h 2005-12-27 12:28:10.464289435 +0100
  4. @@ -65,7 +65,14 @@ Egetgrnam(char const *name)
  5. /*@*/
  6. {
  7. /*@observer@*/struct group const *res = getgrnam(name);
  8. - FatalErrnoError(res==0, 1, "getgrnam()");
  9. +
  10. + FatalErrnoError((res == NULL) && (errno != 0), 1, "getgrnam()");
  11. +
  12. + if (res == NULL)
  13. + {
  14. + fprintf (stderr, "No such group: `%s'\n", name);
  15. + exit (1);
  16. + }
  17. /*@-freshtrans@*/
  18. /*@-mustfreefresh@*/
  19. @@ -80,7 +87,14 @@ Egetpwnam(char const *name)
  20. /*@*/
  21. {
  22. struct passwd const *res = getpwnam(name);
  23. - FatalErrnoError(res==0, 1, "getpwnam()");
  24. +
  25. + FatalErrnoError((res == NULL) && (errno != 0), 1, "getpwnam()");
  26. +
  27. + if (res == NULL)
  28. + {
  29. + fprintf (stderr, "No such user: `%s'\n", name);
  30. + exit (1);
  31. + }
  32. return res;
  33. }