Skip site navigation (1) Skip section navigation (2)

Re: patch for src/backend/main/main.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Michael C(dot) Thornburgh" <zenomt(at)armory(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: patch for src/backend/main/main.c
Date: 2001-01-24 00:52:36
Message-ID: 9963.980297556@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-patches
"Michael C. Thornburgh" <zenomt(at)armory(dot)com> writes:
> + 	len = strlen(pw->pw_name);
> + 	pw_name_persist = (char *) malloc(len+1);
> + 	if (pw_name_persist == (char *)NULL)
> + 	{
> + 		fprintf(stderr, "%s: can't malloc for username\n", argv[0]);
> + 		exit(1);
> + 	}
> + 	strncpy(pw_name_persist, pw->pw_name, len+1);

This could be simplified to
	pw_name_persist = strdup(pw->pw_name);
no?

			regards, tom lane

In response to

pgsql-patches by date

Next:From: Bruce MomjianDate: 2001-01-24 01:38:38
Subject: Re: Re: patch for src/backend/main/main.c
Previous:From: Tom LaneDate: 2001-01-23 22:43:07
Subject: Re: [PATCHES] binary operators on integers

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group