@@ -702,8 +702,6 @@ static void get_ax25(struct lsof_context *ctx,
702702 unsigned long rq , sq , state ;
703703 MALLOC_S len ;
704704 unsigned char rqs , sqs ;
705- static char * vbuf = (char * )NULL ;
706- static size_t vsz = (size_t )0 ;
707705 /*
708706 * Do second time cleanup or first time setup.
709707 */
@@ -734,7 +732,7 @@ static void get_ax25(struct lsof_context *ctx,
734732 * Open the /proc/net/ax25 file, assign a page size buffer to the stream,
735733 * and read it. Store AX25 socket info in the AX25sin[] hash buckets.
736734 */
737- if (!(as = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
735+ if (!(as = open_proc_stream (ctx , p , "r" , 0 )))
738736 return ;
739737 while (fgets (buf , sizeof (buf ) - 1 , as )) {
740738 if (get_fields (ctx , buf , (char * )NULL , & fp , (int * )NULL , 0 ) < 24 )
@@ -1544,8 +1542,6 @@ static void get_icmp(struct lsof_context *ctx, /* context */
15441542 INODETYPE inode ;
15451543 struct icmpin * np , * icmpp ;
15461544 MALLOC_S lal , ral ;
1547- static char * vbuf = (char * )NULL ;
1548- static size_t vsz = (size_t )0 ;
15491545 FILE * xs ;
15501546 /*
15511547 * Do second time cleanup or first time setup.
@@ -1571,7 +1567,7 @@ static void get_icmp(struct lsof_context *ctx, /* context */
15711567 * Open the /proc/net/icmp file, assign a page size buffer to its stream,
15721568 * and read the file. Store icmp info in the Icmpin[] hash buckets.
15731569 */
1574- if (!(xs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
1570+ if (!(xs = open_proc_stream (ctx , p , "r" , 0 )))
15751571 return ;
15761572 while (fgets (buf , sizeof (buf ) - 1 , xs )) {
15771573 if (get_fields (ctx , buf , (char * )NULL , & fp , (int * )NULL , 0 ) < 11 )
@@ -1673,8 +1669,6 @@ static void get_ipx(struct lsof_context *ctx, /* context */
16731669 unsigned long rxq , state , txq ;
16741670 struct ipxsin * ip , * np ;
16751671 MALLOC_S len ;
1676- static char * vbuf = (char * )NULL ;
1677- static size_t vsz = (size_t )0 ;
16781672 FILE * xs ;
16791673 /*
16801674 * Do second time cleanup or first time setup.
@@ -1704,7 +1698,7 @@ static void get_ipx(struct lsof_context *ctx, /* context */
17041698 * Open the /proc/net/ipx file, assign a page size buffer to the stream,
17051699 * and read it. Store IPX socket info in the Ipxsin[] hash buckets.
17061700 */
1707- if (!(xs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
1701+ if (!(xs = open_proc_stream (ctx , p , "r" , 0 )))
17081702 return ;
17091703 while (fgets (buf , sizeof (buf ) - 1 , xs )) {
17101704 if (get_fields (ctx , buf , (char * )NULL , & fp , (int * )NULL , 0 ) < 7 )
@@ -1819,8 +1813,6 @@ static void get_netlink(struct lsof_context *ctx, /* context */
18191813 int h , pr ;
18201814 INODETYPE inode ;
18211815 struct nlksin * np , * lp ;
1822- static char * vbuf = (char * )NULL ;
1823- static size_t vsz = (size_t )0 ;
18241816 FILE * xs ;
18251817 /*
18261818 * Do second time cleanup or first time setup.
@@ -1846,7 +1838,7 @@ static void get_netlink(struct lsof_context *ctx, /* context */
18461838 * Open the /proc/net/netlink file, assign a page size buffer to its stream,
18471839 * and read the file. Store Netlink info in the Nlksin[] hash buckets.
18481840 */
1849- if (!(xs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
1841+ if (!(xs = open_proc_stream (ctx , p , "r" , 0 )))
18501842 return ;
18511843 while (fgets (buf , sizeof (buf ) - 1 , xs )) {
18521844 if (get_fields (ctx , buf , (char * )NULL , & fp , (int * )NULL , 0 ) < 10 )
@@ -1913,8 +1905,6 @@ static void get_pack(struct lsof_context *ctx, /* context */
19131905 INODETYPE inode ;
19141906 struct packin * np , * pp ;
19151907 unsigned long pr ;
1916- static char * vbuf = (char * )NULL ;
1917- static size_t vsz = (size_t )0 ;
19181908 FILE * xs ;
19191909 /*
19201910 * Do second time cleanup or first time setup.
@@ -1940,7 +1930,7 @@ static void get_pack(struct lsof_context *ctx, /* context */
19401930 * Open the /proc/net/packet file, assign a page size buffer to its stream,
19411931 * and read the file. Store packet info in the Packin[] hash buckets.
19421932 */
1943- if (!(xs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
1933+ if (!(xs = open_proc_stream (ctx , p , "r" , 0 )))
19441934 return ;
19451935 while (fgets (buf , sizeof (buf ) - 1 , xs )) {
19461936 if (get_fields (ctx , buf , (char * )NULL , & fp , (int * )NULL , 0 ) < 9 )
@@ -2012,8 +2002,6 @@ static void get_raw(struct lsof_context *ctx, /* context */
20122002 int nf = 12 ;
20132003 struct rawsin * np , * rp ;
20142004 MALLOC_S lal , ral , spl ;
2015- static char * vbuf = (char * )NULL ;
2016- static size_t vsz = (size_t )0 ;
20172005 FILE * xs ;
20182006 /*
20192007 * Do second time cleanup or first time setup.
@@ -2043,7 +2031,7 @@ static void get_raw(struct lsof_context *ctx, /* context */
20432031 * Open the /proc/net/raw file, assign a page size buffer to its stream,
20442032 * and read the file. Store raw socket info in the Rawsin[] hash buckets.
20452033 */
2046- if (!(xs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
2034+ if (!(xs = open_proc_stream (ctx , p , "r" , 0 )))
20472035 return ;
20482036 while (fgets (buf , sizeof (buf ) - 1 , xs )) {
20492037 if (get_fields (ctx , buf , (char * )NULL , & fp , (int * )NULL , 0 ) < nf )
@@ -2150,8 +2138,6 @@ static void get_sctp(struct lsof_context *ctx) {
21502138 MALLOC_S len , plen ;
21512139 struct sctpsin * sp , * np ;
21522140 FILE * ss ;
2153- static char * vbuf = (char * )NULL ;
2154- static size_t vsz = (size_t )0 ;
21552141 /*
21562142 * Do second time cleanup or first time setup.
21572143 */
@@ -2189,7 +2175,7 @@ static void get_sctp(struct lsof_context *ctx) {
21892175 * and read them. Store SCTP socket info in the SCTPsin[] hash buckets.
21902176 */
21912177 for (i = 0 ; i < NSCTPPATHS ; i ++ ) {
2192- if (!(ss = open_proc_stream (ctx , SCTPPath [i ], "r" , & vbuf , & vsz , 0 )))
2178+ if (!(ss = open_proc_stream (ctx , SCTPPath [i ], "r" , 0 )))
21932179 continue ;
21942180 fl = 1 ;
21952181 while (fgets (buf , sizeof (buf ) - 1 , ss )) {
@@ -2516,8 +2502,6 @@ static void get_tcpudp(struct lsof_context *ctx, /* context */
25162502 int h , nf ;
25172503 INODETYPE inode ;
25182504 struct tcp_udp * np , * tp ;
2519- static char * vbuf = (char * )NULL ;
2520- static size_t vsz = (size_t )0 ;
25212505
25222506#if defined(HASEPTOPTS )
25232507 pxinfo_t * pp , * pnp ;
@@ -2598,7 +2582,7 @@ static void get_tcpudp(struct lsof_context *ctx, /* context */
25982582 * Open the /proc/net file, assign a page size buffer to the stream, and
25992583 * read it.
26002584 */
2601- if (!(fs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
2585+ if (!(fs = open_proc_stream (ctx , p , "r" , 0 )))
26022586 return ;
26032587 nf = 12 ;
26042588 while (fgets (buf , sizeof (buf ) - 1 , fs )) {
@@ -2719,8 +2703,6 @@ static void get_raw6(struct lsof_context *ctx, /* context */
27192703 int nf = 12 ;
27202704 struct rawsin * np , * rp ;
27212705 MALLOC_S lal , ral , spl ;
2722- static char * vbuf = (char * )NULL ;
2723- static size_t vsz = (size_t )0 ;
27242706 FILE * xs ;
27252707 /*
27262708 * Do second time cleanup or first time setup.
@@ -2752,7 +2734,7 @@ static void get_raw6(struct lsof_context *ctx, /* context */
27522734 * Open the /proc/net/raw6 file, assign a page size buffer to the stream,
27532735 * and read it. Store raw6 socket info in the Rawsin6[] hash buckets.
27542736 */
2755- if (!(xs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
2737+ if (!(xs = open_proc_stream (ctx , p , "r" , 0 )))
27562738 return ;
27572739 while (fgets (buf , sizeof (buf ) - 1 , xs )) {
27582740 if (get_fields (ctx , buf , (char * )NULL , & fp , (int * )NULL , 0 ) < nf )
@@ -2865,8 +2847,6 @@ static void get_tcpudp6(struct lsof_context *ctx, /* context */
28652847 int h , i , nf ;
28662848 INODETYPE inode ;
28672849 struct tcp_udp6 * np6 , * tp6 ;
2868- static char * vbuf = (char * )NULL ;
2869- static size_t vsz = (size_t )0 ;
28702850
28712851# if defined(HASEPTOPTS )
28722852 pxinfo_t * pp , * pnp ;
@@ -2957,7 +2937,7 @@ static void get_tcpudp6(struct lsof_context *ctx, /* context */
29572937 * Open the /proc/net file, assign a page size buffer to the stream,
29582938 * and read it.
29592939 */
2960- if (!(fs = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
2940+ if (!(fs = open_proc_stream (ctx , p , "r" , 0 )))
29612941 return ;
29622942 nf = 12 ;
29632943 while (fgets (buf , sizeof (buf ) - 1 , fs )) {
@@ -3076,8 +3056,6 @@ static void get_unix(struct lsof_context *ctx, /* context */
30763056 uxsin_t * np , * up ;
30773057 FILE * us ;
30783058 uint32_t ty ;
3079- static char * vbuf = (char * )NULL ;
3080- static size_t vsz = (size_t )0 ;
30813059
30823060#if defined(HASEPTOPTS ) && defined(HASUXSOCKEPT )
30833061 pxinfo_t * pp , * pnp ;
@@ -3119,7 +3097,7 @@ static void get_unix(struct lsof_context *ctx, /* context */
31193097 * Open the /proc/net/unix file, assign a page size buffer to the stream,
31203098 * read the file's contents, and add them to the Uxsin hash buckets.
31213099 */
3122- if (!(us = open_proc_stream (ctx , p , "r" , & vbuf , & vsz , 0 )))
3100+ if (!(us = open_proc_stream (ctx , p , "r" , 0 )))
31233101 return ;
31243102 while (fgets (buf , sizeof (buf ) - 1 , us )) {
31253103 if ((nf = get_fields (ctx , buf , ":" , & fp , (int * )NULL , 0 )) < 7 )
0 commit comments