| From: | "Michael C(dot) Thornburgh" <zenomt(at)armory(dot)com> |
|---|---|
| To: | tgl(at)sss(dot)pgh(dot)pa(dot)us |
| Cc: | pgsql-patches(at)postgresql(dot)org |
| Subject: | Re: patch for src/backend/main/main.c |
| Date: | 2001-01-23 17:31:18 |
| Message-ID: | 10101231731.aa10461@aldebaran.armory.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-patches |
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 <tgl(at)sss(dot)pgh(dot)pa(dot)us>
>
> "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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2001-01-23 17:37:35 | Re: [PATCHES] Re: [HACKERS] ODBC Driver int8 Patch |
| Previous Message | Michael C. Thornburgh | 2001-01-23 16:41:26 | patch for src/backend/main/main.c |