Re: macaddr format fix

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Mike Wyer <mw(at)doc(dot)ic(dot)ac(dot)uk>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: macaddr format fix
Date: 2002-06-14 04:49:26
Message-ID: 200206140449.g5E4nQk00978@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches


Your patch has been added to the PostgreSQL unapplied patches list at:

http://candle.pha.pa.us/cgi-bin/pgpatches

I will try to apply it within the next 48 hours.

---------------------------------------------------------------------------

Mike Wyer wrote:
> Hi,
>
> The macaddr datatype understands most formats of MAC address, except 12
> hex digits with no separators, eg 00AABBCCDDEE
> This is easily remedied with the following patch (against 7.2.1):
>
> --- src/backend/utils/adt/mac.c.old Tue May 28 16:48:34 2002
> +++ src/backend/utils/adt/mac.c Tue May 28 16:49:47 2002
> @@ -39,6 +39,8 @@
>
> count = sscanf(str, "%x:%x:%x:%x:%x:%x", &a, &b, &c, &d, &e,
> &f);
> if (count != 6)
> + count = sscanf(str, "%2x%2x%2x%2x%2x%2x", &a, &b, &c,
> &d, &e, &f);
> + if (count != 6)
> count = sscanf(str, "%x-%x-%x-%x-%x-%x", &a, &b, &c, &d,
> &e, &f);
> if (count != 6)
> count = sscanf(str, "%2x%2x%2x:%2x%2x%2x", &a, &b, &c,
> &d, &e, &f);
>
> ########################## END ########################################
>
> It simply adds two lines to the current checks, and works very well.
>
> Cheers,
> Mike Wyer
> --
> Mike Wyer <mw(at)doc(dot)ic(dot)ac(dot)uk> || "Woof?"
> http://www.doc.ic.ac.uk/~mw || Gaspode the Wonder Dog
> Work: +44 020 7594 8440 ||
> Mobile: +44 07900 897543 || ICQ: 43922064

Content-Description: mac.c.diff

[ Attachment, skipping... ]

>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://archives.postgresql.org

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2002-06-14 04:50:52 Re: guc.c and postgresql.conf.sample constistency checker
Previous Message Bruce Momjian 2002-06-14 04:48:02 Re: FW: Patch for current_schemas to optionally include implicit