Skip to contentSkip to conversation

af_unix: Fix path of /proc/net/unix

PATCH Applied OGAWA Hirofumi 2 participants 2 messages Feb 7, 2004 – Feb 8, 2004

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 af_unix: Fix path of /proc/net/unix

Hi,

/proc/net/unix on 2.4,
c14e0580: 0000000C 00000000 00000000 0002 01 742 /dev/log
c06bfa80: 00000002 00000000 00000000 0002 01 1019617 @0123 ...

/proc/net/unix on 2.6,
c7c85d1c: 0000000C 00000000 00000000 0002 01 1021 /dev/log^@
c551bd5c: 00000002 00000000 00000000 0002 01 5692 ^@0123 ... @

We should overwrite the first "nul" by "@" in the case of abstract path, otherwise currently "netstat -x" can't print, at least. And normal one, odd "nul" was added.

This patch does behavior of 2.4. Please apply.

---

 net/unix/af_unix.c |   15 ++++++++++-----
 1 files changed, 10 insertions(+), 5 deletions(-)
net/unix/af_unix.c renamed from net/unix/af_unix.c~af_unix-abstruct-fix +10 -5
diff -puN net/unix/af_unix.c~af_unix-abstruct-fix net/unix/af_unix.c
@@ -1863,14 +1863,19 @@ static int unix_seq_show(struct seq_file
 			sock_i_ino(s));
 
 		if (u->addr) {
-			int i;
+			int i, len;
 			seq_putc(seq, ' ');
-			
-			for (i = 0; i < u->addr->len-sizeof(short); i++)
-				seq_putc(seq, u->addr->name->sun_path[i]);
 
-			if (UNIX_ABSTRACT(s))
+			i = 0;
+			len = u->addr->len - sizeof(short);
+			if (!UNIX_ABSTRACT(s))
+				len--;
+			else {
 				seq_putc(seq, '@');
+				i++;
+			}
+			for ( ; i < len; i++)
+				seq_putc(seq, u->addr->name->sun_path[i]);
 		}
 		unix_state_runlock(s);
 		seq_putc(seq, '\n');

_

Signature · 1 line
OGAWA Hirofumi <[email protected]>
#1 lore raw
Quoted 5 lines · On Sat, 07 Feb 2004 16:03:48 +0900 OGAWA Hirofumi…

We should overwrite the first "nul" by "@" in the case of abstract path, otherwise currently "netstat -x" can't print, at least. And normal one, odd "nul" was added.

This patch does behavior of 2.4. Please apply.

Applied, thanks.