Index: usr/src/lib/libast/common/sfio/sfsetbuf.c
===================================================================
--- usr/src/lib/libast/common/sfio/sfsetbuf.c	(revision 2152)
+++ usr/src/lib/libast/common/sfio/sfsetbuf.c	(working copy)
@@ -269,13 +269,38 @@
 						f->flags |= SF_LINE|SF_WCWIDTH;
 #if _sys_stat
 					else	/* special case /dev/null */
-					{	reg int	dev, ino;
+					{
+#if 1
+						static sfstat_t devnull_st;
+						static int init=0;
+						
+						if (init==0)
+						{
+							if (sysstatf(DEVNULL, &devnull_st) >= 0)
+							{
+								init=1;
+							}
+							else
+							{
+								init=-1;
+							}
+						}
+						
+						if (init==1)
+						{
+							if (devnull_st.st_dev == st.st_dev &&
+							    devnull_st.st_ino == st.st_ino)
+								SFSETNULL(f);
+						}
+#else
+						reg int	dev, ino;
 						dev = (int)st.st_dev;	
 						ino = (int)st.st_ino;	
 						if(sysstatf(DEVNULL,&st) >= 0 &&
 						   dev == (int)st.st_dev &&
 						   ino == (int)st.st_ino)
 							SFSETNULL(f);
+#endif
 					}
 #endif
 					errno = oerrno;
