nfs/Connection: nfs_get_fd() can return -1
While reconnecting to the NFS server, the socket is -1, because there is no socket. Fixes a potential crash (assertion failure).
This commit is contained in:
		@@ -237,6 +237,9 @@ NfsConnection::ScheduleSocket()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	if (!SocketMonitor::IsDefined()) {
 | 
						if (!SocketMonitor::IsDefined()) {
 | 
				
			||||||
		int _fd = nfs_get_fd(context);
 | 
							int _fd = nfs_get_fd(context);
 | 
				
			||||||
 | 
							if (_fd < 0)
 | 
				
			||||||
 | 
								return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		fd_set_cloexec(_fd, true);
 | 
							fd_set_cloexec(_fd, true);
 | 
				
			||||||
		SocketMonitor::Open(_fd);
 | 
							SocketMonitor::Open(_fd);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user