openbsd-ports/x11/gnome/vfs2/patches/patch-modules_sftp-method_c
ajacoutot 6a425a3014 * gnome-vfs2 cleanups and fixes:
- fix webdav(s) browsing
- don't hardcode /usr/local
- fix some XDG conflicting symbols (from FreeBSD)
- enable gssapi

ok jasper@
2008-05-04 14:36:44 +00:00

744 lines
28 KiB
Plaintext

$OpenBSD: patch-modules_sftp-method_c,v 1.2 2008/05/04 14:36:44 ajacoutot Exp $
--- modules/sftp-method.c.orig Mon Nov 12 09:36:43 2007
+++ modules/sftp-method.c Mon Apr 28 09:15:28 2008
@@ -317,7 +317,7 @@ buffer_send (Buffer *buf, int fd)
g_return_val_if_fail (buf->base != NULL, GNOME_VFS_ERROR_INTERNAL);
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Sending message of length %d from %p to %d",
- G_GNUC_FUNCTION, len, buf, fd));
+ G_STRFUNC, len, buf, fd));
buf->read_ptr -= sizeof (guint32);
@@ -338,7 +338,7 @@ buffer_send (Buffer *buf, int fd)
}
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: %d bytes written",
- G_GNUC_FUNCTION, bytes_written));
+ G_STRFUNC, bytes_written));
return res;
}
@@ -352,24 +352,24 @@ buffer_recv (Buffer *buf, int fd)
g_return_val_if_fail (buf->base != NULL, GNOME_VFS_ERROR_INTERNAL);
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Receiving message from %d to %p",
- G_GNUC_FUNCTION, fd, buf));
+ G_STRFUNC, fd, buf));
bytes_read = atomic_io (read, fd, &r_len, sizeof (guint32));
if (bytes_read == -1) {
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Could not read length: %s",
- G_GNUC_FUNCTION, g_strerror (errno)));
+ G_STRFUNC, g_strerror (errno)));
return GNOME_VFS_ERROR_IO;
}
else if (bytes_read == 0) {
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Connection closed: %d",
- G_GNUC_FUNCTION, fd));
+ G_STRFUNC, fd));
return GNOME_VFS_ERROR_IO;
}
len = GINT32_TO_BE (r_len);
- DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Message is of length %d", G_GNUC_FUNCTION, len));
+ DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Message is of length %d", G_STRFUNC, len));
/* 256K was the max allowed in OpenSSH */
if (len > 256 * 1024) {
@@ -385,7 +385,7 @@ buffer_recv (Buffer *buf, int fd)
}
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: %d bytes read",
- G_GNUC_FUNCTION, bytes_read));
+ G_STRFUNC, bytes_read));
buf->write_ptr += bytes_read;
@@ -518,7 +518,7 @@ buffer_read_file_info (Buffer *buf, GnomeVFSFileInfo *
info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_PERMISSIONS;
info->permissions = buffer_read_gint32 (buf);
- DEBUG4 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Permissions is %x", G_GNUC_FUNCTION,
+ DEBUG4 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Permissions is %x", G_STRFUNC,
info->permissions));
info->valid_fields |= GNOME_VFS_FILE_INFO_FIELDS_TYPE;
@@ -757,7 +757,7 @@ iobuf_read_file_info (int fd, GnomeVFSFileInfo *info,
status = buffer_read_gint32 (&msg);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Reading file info failed with SSH2_FXP_STATUS(%u), status %u",
- G_GNUC_FUNCTION, type, status));
+ G_STRFUNC, type, status));
res = sftp_status_to_vfs_result (status);
} else if (type == SSH2_FXP_ATTRS) {
buffer_read_file_info (&msg, info);
@@ -1189,7 +1189,7 @@ tty_retry:
args[last_arg++] = NULL;
DEBUG (tmp = g_strjoinv (" ", args));
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Command line is %s", G_GNUC_FUNCTION, tmp));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Command line is %s", G_STRFUNC, tmp));
DEBUG (g_free (tmp));
tty_fd = -1;
@@ -1480,7 +1480,7 @@ tty_retry:
/* Response given was not correct. Give up with a protocol error */
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
- "%s: Protocol error: message type is %d", G_GNUC_FUNCTION, type));
+ "%s: Protocol error: message type is %d", G_STRFUNC, type));
res = GNOME_VFS_ERROR_PROTOCOL_ERROR;
} else {
/* Everything's A-OK. Set up the connection and go */
@@ -1571,13 +1571,13 @@ sftp_get_connection (SftpConnection **connection, cons
hash_name = g_strdup (host_name);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
- "%s: Getting connection to %s", G_GNUC_FUNCTION, hash_name));
+ "%s: Getting connection to %s", G_STRFUNC, hash_name));
*connection = g_hash_table_lookup (sftp_connection_table, hash_name);
if (*connection == NULL) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
- "%s: Connection not found. Opening new one.", G_GNUC_FUNCTION));
+ "%s: Connection not found. Opening new one.", G_STRFUNC));
res = sftp_connect (connection, uri);
@@ -1598,7 +1598,7 @@ sftp_get_connection (SftpConnection **connection, cons
#if 0
else if (!g_mutex_trylock ((*connection)->mutex)) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
- "%s: Connection found but locked. Opening new one.", G_GNUC_FUNCTION));
+ "%s: Connection found but locked. Opening new one.", G_STRFUNC));
res = sftp_connect (connection, uri);
g_mutex_lock ((*connection)->mutex);
@@ -1609,13 +1609,13 @@ sftp_get_connection (SftpConnection **connection, cons
#endif
else {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Connection found. Locking",
- G_GNUC_FUNCTION));
+ G_STRFUNC));
g_mutex_lock ((*connection)->mutex);
sftp_connection_ref ((*connection));
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Lock acquired",
- G_GNUC_FUNCTION));
+ G_STRFUNC));
g_free (hash_name);
res = GNOME_VFS_OK;
@@ -1657,25 +1657,25 @@ sftp_connection_process_errors (GIOChannel *channel, G
if (cond != G_IO_IN) return TRUE;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
io_status = g_io_channel_read_line (channel, &str, NULL, NULL, &error);
switch (io_status) {
case G_IO_STATUS_ERROR:
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
- "%s: Could not read error message: %s", G_GNUC_FUNCTION, error->message));
+ "%s: Could not read error message: %s", G_STRFUNC, error->message));
*status = GNOME_VFS_ERROR_IO;
break;
case G_IO_STATUS_EOF:
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
- "%s: Subprocess closed the connection", G_GNUC_FUNCTION));
+ "%s: Subprocess closed the connection", G_STRFUNC));
*status = GNOME_VFS_ERROR_EOF;
return FALSE;
case G_IO_STATUS_AGAIN:
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: No error", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: No error", G_STRFUNC));
*status = GNOME_VFS_OK;
break;
@@ -1689,7 +1689,7 @@ sftp_connection_process_errors (GIOChannel *channel, G
str = str1;
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
- "%s: Error message was %s", G_GNUC_FUNCTION, str));
+ "%s: Error message was %s", G_STRFUNC, str));
}
}
@@ -1720,7 +1720,7 @@ sftp_connection_get_id (SftpConnection *conn)
g_return_val_if_fail (conn != NULL, 0);
id = conn->msg_id++;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Message id %d", G_GNUC_FUNCTION, id));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Message id %d", G_STRFUNC, id));
return id;
}
@@ -1816,12 +1816,12 @@ get_real_path (SftpConnection *conn, const gchar *path
buffer_free (&msg);
*realpath = NULL;
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Bad status (%d).",
- G_GNUC_FUNCTION, status));
+ G_STRFUNC, status));
return sftp_status_to_vfs_result (status);
}
else if (recv_id != id || type != SSH2_FXP_NAME) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Bad message id or type (%d, %d).",
- G_GNUC_FUNCTION, recv_id, type));
+ G_STRFUNC, recv_id, type));
buffer_free (&msg);
return GNOME_VFS_ERROR_PROTOCOL_ERROR;
}
@@ -1830,13 +1830,13 @@ get_real_path (SftpConnection *conn, const gchar *path
if (count == 0) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: File not found: %s",
- G_GNUC_FUNCTION, path));
+ G_STRFUNC, path));
buffer_free (&msg);
return GNOME_VFS_ERROR_NOT_FOUND;
}
else if (count != 1) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Bad count (%d).",
- G_GNUC_FUNCTION, count));
+ G_STRFUNC, count));
buffer_free (&msg);
return GNOME_VFS_ERROR_PROTOCOL_ERROR;
}
@@ -1871,7 +1871,7 @@ do_open (GnomeVFSMethod *method,
gint sftp_handle_len;
gchar *path;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
res = sftp_get_connection (&conn, uri);
if (res != GNOME_VFS_OK) return res;
@@ -1912,7 +1912,7 @@ do_open (GnomeVFSMethod *method,
sftp_connection_unlock (conn);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return GNOME_VFS_OK;
} else {
*method_handle = NULL;
@@ -1922,7 +1922,7 @@ do_open (GnomeVFSMethod *method,
sftp_connection_unref (conn);
sftp_connection_unlock (conn);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return res;
}
}
@@ -1949,7 +1949,7 @@ do_create (GnomeVFSMethod *method,
guint sftp_handle_len;
gchar *path;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
res = sftp_get_connection (&conn, uri);
if (res != GNOME_VFS_OK) return res;
@@ -1997,7 +1997,7 @@ do_create (GnomeVFSMethod *method,
sftp_connection_unlock (conn);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return GNOME_VFS_OK;
} else {
*method_handle = NULL;
@@ -2007,7 +2007,7 @@ do_create (GnomeVFSMethod *method,
sftp_connection_unref (conn);
sftp_connection_unlock (conn);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return res;
}
}
@@ -2024,7 +2024,7 @@ do_close (GnomeVFSMethod *method,
guint i;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
handle = SFTP_OPEN_HANDLE (method_handle);
@@ -2052,7 +2052,7 @@ do_close (GnomeVFSMethod *method,
g_free (handle->path);
g_free (handle);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return status;
}
@@ -2087,7 +2087,7 @@ do_read (GnomeVFSMethod *method,
struct ReadRequest *read_req;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
got_eof = FALSE;
@@ -2120,7 +2120,7 @@ do_read (GnomeVFSMethod *method,
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: (%d) Sending read request %d, length %d, pointer %p",
- G_GNUC_FUNCTION, req_ptr, read_req[req_ptr].id,
+ G_STRFUNC, req_ptr, read_req[req_ptr].id,
read_req[req_ptr].req_len, read_req[req_ptr].ptr));
outstanding++;
@@ -2159,7 +2159,7 @@ do_read (GnomeVFSMethod *method,
if (req_svc == req_ptr) { /* Didn't find the id -- unexpected reply */
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Unexpected id %d",
- G_GNUC_FUNCTION, recv_id));
+ G_STRFUNC, recv_id));
buffer_free (&msg);
g_free (read_req);
sftp_connection_unlock (handle->connection);
@@ -2171,14 +2171,14 @@ do_read (GnomeVFSMethod *method,
status = buffer_read_gint32 (&msg);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Got status message %d",
- G_GNUC_FUNCTION, status));
+ G_STRFUNC, status));
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: req_svc = %d, req_ptr = %d",
- G_GNUC_FUNCTION, req_svc, req_ptr));
+ G_STRFUNC, req_svc, req_ptr));
if (status != SSH2_FX_EOF) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: status return %d",
- G_GNUC_FUNCTION, sftp_status_to_vfs_result (status)));
+ G_STRFUNC, sftp_status_to_vfs_result (status)));
buffer_free (&msg);
g_free (read_req);
sftp_connection_unlock (handle->connection);
@@ -2238,7 +2238,7 @@ do_read (GnomeVFSMethod *method,
buffer_free (&msg);
g_free (read_req);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
sftp_connection_unlock (handle->connection);
@@ -2274,7 +2274,7 @@ do_write (GnomeVFSMethod *method,
struct WriteRequest *write_req;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
handle = SFTP_OPEN_HANDLE (method_handle);
@@ -2303,7 +2303,7 @@ do_write (GnomeVFSMethod *method,
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: (%d) Sending write request %d, length %d, offset %d",
- G_GNUC_FUNCTION, req_ptr, write_req[req_ptr].id,
+ G_STRFUNC, req_ptr, write_req[req_ptr].id,
write_req[req_ptr].req_len, write_req[req_ptr].offset));
buffer_clear (&msg);
@@ -2351,7 +2351,7 @@ do_write (GnomeVFSMethod *method,
if (req_svc == req_ptr) { /* Didn't find the id -- unexpected reply */
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Unexpected id %d",
- G_GNUC_FUNCTION, recv_id));
+ G_STRFUNC, recv_id));
buffer_free (&msg);
g_free (write_req);
sftp_connection_unlock (handle->connection);
@@ -2372,7 +2372,7 @@ do_write (GnomeVFSMethod *method,
buffer_free (&msg);
g_free (write_req);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
sftp_connection_unlock (handle->connection);
@@ -2390,7 +2390,7 @@ do_seek (GnomeVFSMethod *method,
GnomeVFSFileInfo file_info;
GnomeVFSResult res;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
handle = SFTP_OPEN_HANDLE (method_handle);
@@ -2414,7 +2414,7 @@ do_seek (GnomeVFSMethod *method,
break;
}
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return GNOME_VFS_OK;
}
@@ -2426,12 +2426,12 @@ do_tell (GnomeVFSMethod *method,
{
SftpOpenHandle *handle;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
handle = SFTP_OPEN_HANDLE (method_handle);
*offset_return = handle->offset;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return GNOME_VFS_OK;
}
@@ -2446,12 +2446,12 @@ sftp_readlink (SftpConnection *connection,
unsigned int id;
char *ret;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
id = sftp_connection_get_id (connection);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Requesting symlink target for %s",
- G_GNUC_FUNCTION, path));
+ G_STRFUNC, path));
buffer_init (&msg);
buffer_write_gchar (&msg, SSH2_FXP_READLINK);
@@ -2469,7 +2469,7 @@ sftp_readlink (SftpConnection *connection,
ret = NULL;
if (recv_id != id)
- g_critical ("%s: ID mismatch (%u != %u)", G_GNUC_FUNCTION, recv_id, id);
+ g_critical ("%s: ID mismatch (%u != %u)", G_STRFUNC, recv_id, id);
else if (type == SSH2_FXP_NAME) {
int count;
@@ -2478,20 +2478,20 @@ sftp_readlink (SftpConnection *connection,
ret = buffer_read_string (&msg, NULL);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Symlink resolved to %s",
- G_GNUC_FUNCTION, ret));
+ G_STRFUNC, ret));
} else {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Readlink failed, got unexpected filename count (%d, 1 expected)",
- G_GNUC_FUNCTION, count));
+ G_STRFUNC, count));
}
} else if (type == SSH2_FXP_STATUS) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Readlink failed, SSH2_FXP_STATUS response",
- G_GNUC_FUNCTION));
+ G_STRFUNC));
} else {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Readlink failed, bad response (%d)",
- G_GNUC_FUNCTION, type));
+ G_STRFUNC, type));
}
buffer_free (&msg);
@@ -2549,11 +2549,11 @@ get_file_info_for_path (SftpConnection *conn,
GnomeVFSResult res;
unsigned int id;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
if (conn->version == 0) { /* SSH2_FXP_STAT_VERSION_0 doesn't allow our symlink semantics */
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Server with protocol version 0 detected, LSTAT unsupported.",
- G_GNUC_FUNCTION));
+ G_STRFUNC));
return GNOME_VFS_ERROR_NOT_SUPPORTED;
}
@@ -2574,7 +2574,7 @@ get_file_info_for_path (SftpConnection *conn,
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Got GNOME_VFS_FILE_INFO_FOLLOW_LINKS, encountered symlink, resolving.",
- G_GNUC_FUNCTION));
+ G_STRFUNC));
followed_symlinks = 0;
@@ -2592,7 +2592,7 @@ get_file_info_for_path (SftpConnection *conn,
if (++followed_symlinks > MAX_SYMLINKS_FOLLOWED) {
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Too many symlinks while resolving %s.",
- G_GNUC_FUNCTION, target_path));
+ G_STRFUNC, target_path));
res = GNOME_VFS_ERROR_TOO_MANY_LINKS;
/* we signal failure but still fill the file_info as good as we can.
* Is this allowed? */
@@ -2603,12 +2603,12 @@ get_file_info_for_path (SftpConnection *conn,
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Resolved %s to %s",
- G_GNUC_FUNCTION, target_path != NULL ? target_path : path, next_target_reference));
+ G_STRFUNC, target_path != NULL ? target_path : path, next_target_reference));
if (next_target_reference == NULL) {
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Resultion of %s to %s failed, target probably nonexistant.",
- G_GNUC_FUNCTION, target_path, next_target_reference));
+ G_STRFUNC, target_path, next_target_reference));
break;
}
@@ -2626,7 +2626,7 @@ get_file_info_for_path (SftpConnection *conn,
(target_info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE) == 0) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Resultion of %s to %s failed, could not get file info.",
- G_GNUC_FUNCTION, target_path, next_target_reference));
+ G_STRFUNC, target_path, next_target_reference));
res = GNOME_VFS_OK;
break;
}
@@ -2641,7 +2641,7 @@ get_file_info_for_path (SftpConnection *conn,
if (target_info->type != GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) {
DEBUG2 (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Aborting symlink resolution, %s is no symlink.",
- G_GNUC_FUNCTION, target_path));
+ G_STRFUNC, target_path));
break;
}
@@ -2651,7 +2651,7 @@ get_file_info_for_path (SftpConnection *conn,
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: Resolved %s -> %s",
- G_GNUC_FUNCTION, path, target_path));
+ G_STRFUNC, path, target_path));
if (last_valid_target_info != NULL) {
gnome_vfs_file_info_clear (file_info);
@@ -2672,7 +2672,7 @@ get_file_info_for_path (SftpConnection *conn,
update_mime_type_and_name_from_path (file_info, path, options);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return res;
}
@@ -2688,7 +2688,7 @@ do_get_file_info (GnomeVFSMethod *method,
GnomeVFSResult res;
char *path;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter (no exit notify)", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter (no exit notify)", G_STRFUNC));
res = sftp_get_connection (&conn, uri);
if (res != GNOME_VFS_OK) return res;
@@ -2712,7 +2712,7 @@ do_get_file_info_from_handle (GnomeVFSMethod
{
SftpOpenHandle *handle;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter (no exit notify)", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter (no exit notify)", G_STRFUNC));
handle = SFTP_OPEN_HANDLE (method_handle);
@@ -2746,7 +2746,7 @@ do_open_directory (GnomeVFSMethod *method,
guint id, sftp_handle_len;
gchar *path;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
res = sftp_get_connection (&conn, uri);
if (res != GNOME_VFS_OK) return res;
@@ -2755,7 +2755,7 @@ do_open_directory (GnomeVFSMethod *method,
URI_TO_PATH (uri, path);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Opening %s", G_GNUC_FUNCTION, path));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Opening %s", G_STRFUNC, path));
buffer_init (&msg);
buffer_write_gchar (&msg, SSH2_FXP_OPENDIR);
@@ -2767,7 +2767,7 @@ do_open_directory (GnomeVFSMethod *method,
res = iobuf_read_handle (conn->in_fd, &sftp_handle, id, &sftp_handle_len);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Result is %d", G_GNUC_FUNCTION, res));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Result is %d", G_STRFUNC, res));
if (res == GNOME_VFS_OK) {
handle = g_new0 (SftpOpenHandle, 1);
@@ -2785,8 +2785,8 @@ do_open_directory (GnomeVFSMethod *method,
sftp_connection_unlock (conn);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Opened directory %p",
- G_GNUC_FUNCTION, handle));
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ G_STRFUNC, handle));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return GNOME_VFS_OK;
} else {
/* For some reason, some servers report EOF when the directory doesn't exist. *shrug* */
@@ -2799,7 +2799,7 @@ do_open_directory (GnomeVFSMethod *method,
sftp_connection_unlock (conn);
*method_handle = NULL;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return res;
}
}
@@ -2824,25 +2824,25 @@ do_read_directory (GnomeVFSMethod *method,
Buffer msg;
gchar type;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
handle = SFTP_OPEN_HANDLE (method_handle);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Reading directory %p",
- G_GNUC_FUNCTION, handle));
+ G_STRFUNC, handle));
if (handle->info_read_ptr < handle->info_write_ptr) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Found directory entry %s in cache",
- G_GNUC_FUNCTION, handle->info[handle->info_read_ptr].name));
+ G_STRFUNC, handle->info[handle->info_read_ptr].name));
gnome_vfs_file_info_copy (file_info, &(handle->info[handle->info_read_ptr++]));
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
return GNOME_VFS_OK;
}
sftp_connection_lock (handle->connection);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: No entries in cache", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: No entries in cache", G_STRFUNC));
id = sftp_connection_get_id (handle->connection);
@@ -2872,12 +2872,12 @@ do_read_directory (GnomeVFSMethod *method,
if (status == SSH2_FX_EOF || SSH2_FX_OK) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: End of directory reached (EOF status)",
- G_GNUC_FUNCTION));
+ G_STRFUNC));
sftp_connection_unlock (handle->connection);
return GNOME_VFS_ERROR_EOF;
} else {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Error status %d",
- G_GNUC_FUNCTION, status));
+ G_STRFUNC, status));
do_close (method, method_handle, context);
sftp_connection_unlock (handle->connection);
return sftp_status_to_vfs_result (status);
@@ -2888,13 +2888,13 @@ do_read_directory (GnomeVFSMethod *method,
if (count == 0) {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG,
"%s: End of directory reached (count 0)",
- G_GNUC_FUNCTION));
+ G_STRFUNC));
buffer_free (&msg);
sftp_connection_unlock (handle->connection);
return GNOME_VFS_ERROR_EOF;
}
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Count is %d", G_GNUC_FUNCTION, count));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Count is %d", G_STRFUNC, count));
if (handle->info_write_ptr + count > handle->info_alloc) {
if (handle->info_read_ptr > 0) {
@@ -2928,7 +2928,7 @@ do_read_directory (GnomeVFSMethod *method,
buffer_read_file_info (&msg, info);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: %d, filename is %s",
- G_GNUC_FUNCTION, i, filename));
+ G_STRFUNC, i, filename));
if (info->valid_fields & GNOME_VFS_FILE_INFO_FIELDS_TYPE &&
info->type == GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK) {
@@ -2940,7 +2940,7 @@ do_read_directory (GnomeVFSMethod *method,
update_mime_type_and_name_from_path (info, filename, handle->dir_options);
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: %d, MIME type is %s",
- G_GNUC_FUNCTION, i, info->mime_type));
+ G_STRFUNC, i, info->mime_type));
g_free (filename);
g_free (longname);
@@ -2949,7 +2949,7 @@ do_read_directory (GnomeVFSMethod *method,
}
} else {
DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Got wrong packet type (%d)",
- G_GNUC_FUNCTION, type));
+ G_STRFUNC, type));
buffer_free (&msg);
sftp_connection_unlock (handle->connection);
return GNOME_VFS_ERROR_PROTOCOL_ERROR;
@@ -2964,11 +2964,11 @@ do_read_directory (GnomeVFSMethod *method,
g_free (handle->info[handle->info_read_ptr].mime_type);
handle->info[handle->info_read_ptr].mime_type = NULL;
handle->info_read_ptr++;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
sftp_connection_unlock (handle->connection);
return GNOME_VFS_OK;
} else {
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit", G_STRFUNC));
sftp_connection_unlock (handle->connection);
return GNOME_VFS_ERROR_EOF;
}
@@ -3144,11 +3144,12 @@ do_rename (GnomeVFSMethod *method,
buffer_send (&msg, conn->out_fd);
buffer_free (&msg);
+ res = iobuf_read_result (conn->in_fd, id);
+
+bail:
g_free (old_path);
g_free (new_path);
- res = iobuf_read_result (conn->in_fd, id);
-
sftp_connection_unref (conn);
sftp_connection_unlock (conn);
@@ -3238,7 +3239,7 @@ do_set_file_info (GnomeVFSMethod *method,
guint id;
gchar *path;
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_GNUC_FUNCTION));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Enter", G_STRFUNC));
if ((mask & ~(GNOME_VFS_SET_FILE_INFO_NAME |
GNOME_VFS_SET_FILE_INFO_PERMISSIONS |
@@ -3270,7 +3271,7 @@ do_set_file_info (GnomeVFSMethod *method,
if (res == GNOME_VFS_OK && (mask & GNOME_VFS_SET_FILE_INFO_NAME))
res = do_rename (method, uri, info->name, context);
- DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit: %d", G_GNUC_FUNCTION, res));
+ DEBUG (g_log (G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "%s: Exit: %d", G_STRFUNC, res));
return res;
}