The following commit has been merged in the master branch: commit 25d4a1752f91014702d4e06d96a73f182c6d8c42 Author: Guillem Jover <guil...@debian.org> Date: Wed Jan 14 11:45:03 2009 +0200
s-s-d: Use a new xstrdup that never returns NULL instead of strdup diff --git a/ChangeLog b/ChangeLog index 29dbab5..8383951 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2009-01-14 Guillem Jover <guil...@debian.org> + + * utils/start-stop-daemon.c (xstrdup): New function. + (parse_options): Use xstrdup instead of strdup. + 2009-01-10 Guillem Jover <guil...@debian.org> * utils/start-stop-daemon.c (main): If changeuser is a uid, call diff --git a/utils/start-stop-daemon.c b/utils/start-stop-daemon.c index 40366c6..a12a0fe 100644 --- a/utils/start-stop-daemon.c +++ b/utils/start-stop-daemon.c @@ -199,6 +199,17 @@ xmalloc(int size) fatal("malloc(%d) failed", size); } +static char * +xstrdup(const char *str) +{ + char *new_str; + + new_str = strdup(str); + if (new_str) + return new_str; + fatal("strdup(%s) failed", str); +} + static void xgettimeofday(struct timeval *tv) { @@ -584,7 +595,7 @@ parse_options(int argc, char * const *argv) case 'c': /* --chuid <username>|<uid> */ /* we copy the string just in case we need the * argument later. */ - changeuser = strdup(optarg); + changeuser = xstrdup(optarg); changeuser = strtok(changeuser, ":"); changegroup = strtok(NULL, ":"); break; -- dpkg's main repository -- To UNSUBSCRIBE, email to debian-dpkg-cvs-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org