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

Поиск
Список
Период
Сортировка
Искать
От
Bruce Momjian
Тема
Re: Re: patch for src/backend/main/main.c
Дата
Msg-id
200101240138.UAA16443@candle.pha.pa.us
Ответ на
Список
Дерево обсуждения
Re: Re: patch for src/backend/main/main.c "Michael C. Thornburgh" <zenomt@armory.com>
Re: Re: patch for src/backend/main/main.c Tom Lane <tgl@sss.pgh.pa.us>
Re: Re: patch for src/backend/main/main.c Bruce Momjian <pgman@candle.pha.pa.us>
Re: Re: patch for src/backend/main/main.c Bruce Momjian <pgman@candle.pha.pa.us>
We already use strdup a lot.  Want to send a new patch?


> 
> that certainly works and is much cleaner, but strdup
> may not be as ubiquitous as malloc & strncpy.
> someone more versed in portability issues than i am
> should speak to that.
> 
> -michael thornburgh
> 
> 
> > From: Tom Lane 
> > 
> > "Michael C. Thornburgh"  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
> 


-- 
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026
В списке pgsql-patches по дате отправления
От: Michael C. Thornburgh
Дата:
От: Alfred Perlstein
Дата:
FAQ