This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix ether_ntoa() output format


Hi everybody!
 
I have bumped into issue in ether_ntoa() implementation.
All leading zeros were suppressed.
e.g instead of 00:01:13:25:18:fa
0:1:13:25:18:fa is printed.
 
As far as issue is minor and straightforward to fix, I'm sending bugfix
instead of opening issue in bugzilla. Please accept it, if it's possible.
 
P.S: please CC me in reply because I'm not subscribed to the mailing list.
 
Thanks,
Nikita
 
2010-07-26  Nikita Izyumtsev  <nikita.izyumtsev@gmail.com>
 
	* inet/ether_ntoa_r.c (ether_ntoa_r): fix ether_ntoa() output format.
 
---------------------------------------------
>From 474c9f61d079aa4e3c46ac0f9c4d1019dea1dbad Mon Sep 17 00:00:00 2001
From: Nikita Izyumtsev <nikita.izyumtsev@gmail.com>
Date: Sat, 24 Jul 2010 23:54:02 +0300
Subject: [PATCH] Fix ether_ntoa() output format
 
All leading zeros were suppressed.
e.g instead of 00:01:13:25:18:fa
0:1:13:25:18:fa is printed.
---
 inet/ether_ntoa_r.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
 
diff --git a/inet/ether_ntoa_r.c b/inet/ether_ntoa_r.c
index c5f347c..5730e60 100644
--- a/inet/ether_ntoa_r.c
+++ b/inet/ether_ntoa_r.c
@@ -25,7 +25,7 @@
 char *
 ether_ntoa_r (const struct ether_addr *addr, char *buf)
 {
-  sprintf (buf, "%x:%x:%x:%x:%x:%x",
+  sprintf (buf, "%02x:%02x:%02x:%02x:%02x:%02x",
        addr->ether_addr_octet[0], addr->ether_addr_octet[1],
        addr->ether_addr_octet[2], addr->ether_addr_octet[3],
        addr->ether_addr_octet[4], addr->ether_addr_octet[5]);
--
1.7.0.2
---------------------------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]