* vfs/ftpfs.c (ftpfs_open_socket): Let the user interrupt ftpfs in

hostname lookup / connection state.
This commit is contained in:
Pavel Tsekov 2006-02-05 11:18:12 +00:00
parent c29b321563
commit 115ef55682
2 changed files with 9 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2006-02-05 Arpie <arpi@mplayerhq.hu>
* ftpfs.c (ftpfs_open_socket): Let the user interrupt ftpfs in
hostname lookup / connection state.
2006-02-03 Roland Illig <roland.illig@gmx.de> 2006-02-03 Roland Illig <roland.illig@gmx.de>
* fish.c: Replaced the printf-like attribute with __printf__, * fish.c: Replaced the printf-like attribute with __printf__,

View File

@ -663,6 +663,8 @@ ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
free_host = 1; free_host = 1;
} }
enable_interrupt_key(); /* clear the interrupt flag */
/* Get host address */ /* Get host address */
memset ((char *) &server_address, 0, sizeof (server_address)); memset ((char *) &server_address, 0, sizeof (server_address));
server_address.sin_family = AF_INET; server_address.sin_family = AF_INET;
@ -670,6 +672,7 @@ ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
if (server_address.sin_addr.s_addr == INADDR_NONE) { if (server_address.sin_addr.s_addr == INADDR_NONE) {
hp = gethostbyname (host); hp = gethostbyname (host);
if (hp == NULL){ if (hp == NULL){
disable_interrupt_key();
print_vfs_message (_("ftpfs: Invalid host address.")); print_vfs_message (_("ftpfs: Invalid host address."));
ftpfs_errno = EINVAL; ftpfs_errno = EINVAL;
if (free_host) if (free_host)
@ -686,6 +689,7 @@ ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
/* Connect */ /* Connect */
if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) { if ((my_socket = socket (AF_INET, SOCK_STREAM, 0)) < 0) {
disable_interrupt_key();
ftpfs_errno = errno; ftpfs_errno = errno;
if (free_host) if (free_host)
g_free (host); g_free (host);
@ -696,8 +700,6 @@ ftpfs_open_socket (struct vfs_class *me, struct vfs_s_super *super)
if (free_host) if (free_host)
g_free (host); g_free (host);
enable_interrupt_key (); /* clear the interrupt flag */
if (connect (my_socket, (struct sockaddr *) &server_address, if (connect (my_socket, (struct sockaddr *) &server_address,
sizeof (server_address)) < 0){ sizeof (server_address)) < 0){
ftpfs_errno = errno; ftpfs_errno = errno;