Mercurial > gftp.yaz
comparison lib/protocols.c @ 182:33b394ebba68
2003-6-15 Brian Masney <masneyb@gftp.org>
* lib/cache.c lib/gftp.h - added gftp_generate_cache_description().
* lib/cache.c lib/gftp.h src/text/gftp-text.c src/gtk/delete-dialog.c
src/gtk/menu-items.c src/gtk/misc-gtk.c src/gtk/mkdir-dialog.c - Added
description parameter to gftp_delete_cache_entry().
* lib/protocols.c lib/gftp.h - added gftp_fd_open(). It will call
open() and then set the socket option close on exec
* lib/cache.c lib/local.c lib/misc.c - use gftp_fd_open() instead of
open()
* lib/rfc959.c lib/protocols.c - on newly created sockets, make sure
the close on exec socket option is set
* lib/options.h src/text/gftp-text.c src/gtk/transfer.c - added
preserve_permissions option
* lib/protocols.c (gftp_parse_url) - allow an @ to be in the username
* src/text/gftp-text.c - after transfering a file, honor
preserve_permissions if it is set
* src/gtk/delete-dialog.c - improvments to clearing the expired cache
entries
author | masneyb |
---|---|
date | Sun, 15 Jun 2003 21:28:02 +0000 |
parents | 8d933999bba6 |
children | 65eb40fb4f03 |
comparison
equal
deleted
inserted
replaced
181:0153a867819c | 182:33b394ebba68 |
---|---|
557 request->directory = g_strdup (pos); | 557 request->directory = g_strdup (pos); |
558 g_free (stpos); | 558 g_free (stpos); |
559 return (0); | 559 return (0); |
560 } | 560 } |
561 | 561 |
562 if ((endhostpos = strchr (pos, '@')) != NULL) | 562 if ((endhostpos = strrchr (pos, '@')) != NULL) |
563 { | 563 { |
564 /* A user/password was entered */ | 564 /* A user/password was entered */ |
565 if ((endpos = strchr (pos, ':')) == NULL || endhostpos < endpos) | 565 if ((endpos = strchr (pos, ':')) == NULL || endhostpos < endpos) |
566 { | 566 { |
567 /* No password was entered */ | 567 /* No password was entered */ |
1787 return (GFTP_ERETRYABLE); | 1787 return (GFTP_ERETRYABLE); |
1788 } | 1788 } |
1789 port = ntohs (port); | 1789 port = ntohs (port); |
1790 #endif /* HAVE_GETADDRINFO */ | 1790 #endif /* HAVE_GETADDRINFO */ |
1791 | 1791 |
1792 if (fcntl (sock, F_SETFD, 1) == -1) | |
1793 { | |
1794 request->logging_function (gftp_logging_error, request->user_data, | |
1795 _("Error: Cannot set close on exec flag: %s\n"), | |
1796 g_strerror (errno)); | |
1797 | |
1798 return (GFTP_ERETRYABLE); | |
1799 } | |
1800 | |
1792 request->logging_function (gftp_logging_misc, request->user_data, | 1801 request->logging_function (gftp_logging_misc, request->user_data, |
1793 _("Connected to %s:%d\n"), connect_host, port); | 1802 _("Connected to %s:%d\n"), connect_host, port); |
1794 | 1803 |
1795 if (gftp_fd_set_sockblocking (request, sock, 1) < 0) | 1804 if (gftp_fd_set_sockblocking (request, sock, 1) < 0) |
1796 { | 1805 { |
2368 return (GFTP_EFATAL); | 2377 return (GFTP_EFATAL); |
2369 | 2378 |
2370 return (0); | 2379 return (0); |
2371 } | 2380 } |
2372 | 2381 |
2382 | |
2383 int | |
2384 gftp_fd_open (gftp_request * request, const char *pathname, int flags, mode_t mode) | |
2385 { | |
2386 mode_t mask; | |
2387 int fd; | |
2388 | |
2389 if (mode == 0 && (flags & O_CREAT)) | |
2390 { | |
2391 mask = umask (0); /* FIXME - improve */ | |
2392 umask (mask); | |
2393 mode = 0666 & ~mask; | |
2394 } | |
2395 | |
2396 if ((fd = open (pathname, flags, mode)) < 0) | |
2397 { | |
2398 if (request != NULL) | |
2399 request->logging_function (gftp_logging_error, request->user_data, | |
2400 _("Error: Cannot open local file %s: %s\n"), | |
2401 pathname, g_strerror (errno)); | |
2402 return (GFTP_ERETRYABLE); | |
2403 } | |
2404 | |
2405 if (fcntl (fd, F_SETFD, 1) == -1) | |
2406 { | |
2407 if (request != NULL) | |
2408 request->logging_function (gftp_logging_error, request->user_data, | |
2409 _("Error: Cannot set close on exec flag: %s\n"), | |
2410 g_strerror (errno)); | |
2411 | |
2412 return (-1); | |
2413 } | |
2414 | |
2415 return (fd); | |
2416 } | |
2417 |