Ticket #358: ftpfs.patch
File ftpfs.patch, 2.7 KB (added by boris, 10 years ago) |
---|
-
src/vfs/ftpfs/ftpfs.c
a b 989 989 SUP->strict = ftpfs_use_unix_list_options ? RFC_AUTODETECT : RFC_STRICT; 990 990 SUP->isbinary = TYPE_UNKNOWN; 991 991 SUP->remote_is_amiga = 0; 992 SUP->ctl_connection_busy = 0; 992 993 super->name = g_strdup ("/"); 993 994 super->root = 994 995 vfs_s_new_inode (vpath_element->class, super, … … 1359 1360 int s, j, data; 1360 1361 socklen_t fromlen = sizeof (from); 1361 1362 1363 /* FTP doesn't allow to open more than one file at a time */ 1364 if (SUP->ctl_connection_busy) 1365 return -1; 1366 1362 1367 s = ftpfs_initconn (me, super); 1363 1368 if (s == -1) 1364 1369 return -1; … … 1399 1404 close (s); 1400 1405 } 1401 1406 tty_disable_interrupt_key (); 1407 SUP->ctl_connection_busy = 1; 1402 1408 return data; 1403 1409 } 1404 1410 … … 1714 1720 { 1715 1721 me->verrno = ECONNRESET; 1716 1722 close (sock); 1723 SUP->ctl_connection_busy = 0; 1717 1724 tty_disable_interrupt_key (); 1718 1725 ftpfs_get_reply (me, SUP->sock, NULL, 0); 1719 1726 vfs_print_message (_("%s: failure"), me->name); … … 1742 1749 } 1743 1750 1744 1751 close (sock); 1752 SUP->ctl_connection_busy = 0; 1745 1753 me->verrno = E_REMOTE; 1746 1754 if ((ftpfs_get_reply (me, SUP->sock, NULL, 0) != COMPLETE)) 1747 1755 goto fallback; … … 1807 1815 if (h == -1) 1808 1816 ERRNOR (EIO, -1); 1809 1817 1810 sock = 1811 ftpfs_open_data_connection (me, super, ftp->append ? "APPE" : "STOR", name, TYPE_BINARY, 0); 1812 if (sock < 0 || fstat (h, &s) == -1) 1818 if (fstat (h, &s) == -1 || 1819 ((sock = ftpfs_open_data_connection (me, super, ftp->append ? "APPE" : "STOR", name, TYPE_BINARY, 0)) < 0)) 1813 1820 { 1814 1821 close (h); 1815 1822 return -1; … … 1863 1870 } 1864 1871 tty_disable_interrupt_key (); 1865 1872 close (sock); 1873 SUP->ctl_connection_busy = 0; 1866 1874 close (h); 1867 1875 if (ftpfs_get_reply (me, SUP->sock, NULL, 0) != COMPLETE) 1868 1876 ERRNOR (EIO, -1); … … 1870 1878 error_return: 1871 1879 tty_disable_interrupt_key (); 1872 1880 close (sock); 1881 SUP->ctl_connection_busy = 0; 1873 1882 close (h); 1874 1883 ftpfs_get_reply (me, SUP->sock, NULL, 0); 1875 1884 return -1; … … 1893 1902 if (FH_SOCK == -1) 1894 1903 ERRNOR (EACCES, 0); 1895 1904 fh->linear = LS_LINEAR_OPEN; 1896 ((ftp_super_data_t *) (FH_SUPER->data))->ctl_connection_busy = 1;1897 1905 ((ftp_fh_data_t *) fh->data)->append = 0; 1898 1906 return 1; 1899 1907 } … … 2208 2216 2209 2217 close (fh->handle); 2210 2218 fh->handle = -1; 2219 ftp->ctl_connection_busy = 0; 2211 2220 /* File is stored to destination already, so 2212 2221 * we prevent MEDATA->ftpfs_file_store() call from vfs_s_close () 2213 2222 */ … … 2216 2225 ERRNOR (EIO, -1); 2217 2226 vfs_s_invalidate (me, FH_SUPER); 2218 2227 } 2219 2220 2228 return 0; 2221 2229 } 2222 2230