wmifs: Error handling when fopen fails.
This prevents fgets from segfaulting on the next line, closing Debian bug #901353. Thanks to <anomie@users.sourceforge.net> for the bug report and patch.
This commit is contained in:
		
							parent
							
								
									8b31ced398
								
							
						
					
					
						commit
						b03c910dc2
					
				
					 1 changed files with 2 additions and 0 deletions
				
			
		| 
						 | 
					@ -764,6 +764,8 @@ int get_statistics(char *devname, long *ip, long *op, long *is, long *os)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* Read from /proc/net/dev the stats! */
 | 
						/* Read from /proc/net/dev the stats! */
 | 
				
			||||||
	fp = fopen("/proc/net/dev", "r");
 | 
						fp = fopen("/proc/net/dev", "r");
 | 
				
			||||||
 | 
						if (!fp)
 | 
				
			||||||
 | 
							return -1
 | 
				
			||||||
	if (!fgets(temp, BUFFER_SIZE, fp)) {
 | 
						if (!fgets(temp, BUFFER_SIZE, fp)) {
 | 
				
			||||||
		fclose(fp);
 | 
							fclose(fp);
 | 
				
			||||||
		return -1;
 | 
							return -1;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue