Fix a really stupid mistake on my part, and correct a crash when opening

files over NFS.

PR:		115969
Submitted by:	Oleg Sharoiko <os@rsu.ru>
This commit is contained in:
Joe Marcus Clarke 2007-09-03 22:50:59 +00:00
parent d9554c2601
commit c45973ad47
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=198715
2 changed files with 21 additions and 15 deletions

View File

@ -8,7 +8,7 @@
PORTNAME= anjuta PORTNAME= anjuta
PORTVERSION= 2.2.0 PORTVERSION= 2.2.0
PORTREVISION= 4 PORTREVISION= 5
CATEGORIES= devel gnome CATEGORIES= devel gnome
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE} MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= anjuta MASTER_SITE_SUBDIR= anjuta

View File

@ -1,6 +1,6 @@
--- plugins/document-manager/anjuta-docman.c.orig Sun Jul 8 03:12:10 2007 --- plugins/document-manager/anjuta-docman.c.orig Thu Jun 7 14:56:53 2007
+++ plugins/document-manager/anjuta-docman.c Sun Jul 8 03:20:22 2007 +++ plugins/document-manager/anjuta-docman.c Fri Aug 31 16:53:19 2007
@@ -902,6 +902,7 @@ anjuta_docman_goto_file_line_mark (Anjut @@ -902,6 +902,7 @@
const gchar *linenum; const gchar *linenum;
glong lineno; glong lineno;
gboolean is_local_uri; gboolean is_local_uri;
@ -8,19 +8,22 @@
gchar *normalized_path = NULL; gchar *normalized_path = NULL;
IAnjutaEditor *te; IAnjutaEditor *te;
@@ -926,9 +927,9 @@ anjuta_docman_goto_file_line_mark (Anjut @@ -926,9 +927,11 @@
/* Get the normalized file path for comparision */ /* Get the normalized file path for comparision */
is_local_uri = gnome_vfs_uri_is_local (vfs_uri); is_local_uri = gnome_vfs_uri_is_local (vfs_uri);
if (is_local_uri) if (is_local_uri)
- normalized_path = realpath (gnome_vfs_uri_get_path (vfs_uri), NULL); - normalized_path = realpath (gnome_vfs_uri_get_path (vfs_uri), NULL);
+ normalized_path = realpath (gnome_vfs_uri_get_path (vfs_uri), normalized_path_buf); - if (normalized_path == NULL)
if (normalized_path == NULL)
- normalized_path = g_strdup (uri); - normalized_path = g_strdup (uri);
+ (void) strlcpy (normalized_path, uri, PATH_MAX); + normalized_path = realpath (gnome_vfs_uri_get_path (vfs_uri), normalized_path_buf);
+ if (normalized_path == NULL) {
+ (void) strlcpy (normalized_path_buf, uri, PATH_MAX);
+ normalized_path = normalized_path_buf;
+ }
gnome_vfs_uri_unref (vfs_uri); gnome_vfs_uri_unref (vfs_uri);
/* g_free(filename); */ /* g_free(filename); */
@@ -942,6 +943,7 @@ anjuta_docman_goto_file_line_mark (Anjut @@ -942,6 +945,7 @@
AnjutaDocmanPage *page; AnjutaDocmanPage *page;
gboolean te_is_local_uri; gboolean te_is_local_uri;
gchar *te_uri; gchar *te_uri;
@ -28,19 +31,22 @@
gchar *te_normalized_path = NULL; gchar *te_normalized_path = NULL;
page = (AnjutaDocmanPage *) node->data; page = (AnjutaDocmanPage *) node->data;
@@ -959,9 +961,9 @@ anjuta_docman_goto_file_line_mark (Anjut @@ -959,9 +963,11 @@
te_is_local_uri = gnome_vfs_uri_is_local (vfs_uri); te_is_local_uri = gnome_vfs_uri_is_local (vfs_uri);
if (te_is_local_uri) if (te_is_local_uri)
te_normalized_path = realpath (gnome_vfs_uri_get_path (vfs_uri), te_normalized_path = realpath (gnome_vfs_uri_get_path (vfs_uri),
- NULL); - NULL);
+ te_normalized_path_buf); - if (te_normalized_path == NULL)
if (te_normalized_path == NULL)
- te_normalized_path = g_strdup (te_uri); - te_normalized_path = g_strdup (te_uri);
+ (void) strlcpy (te_normalized_path, te_uri, PATH_MAX); + te_normalized_path_buf);
+ if (te_normalized_path == NULL) {
+ (void) strlcpy (te_normalized_path_buf, te_uri, PATH_MAX);
+ te_normalized_path = te_normalized_path_buf;
+ }
gnome_vfs_uri_unref (vfs_uri); gnome_vfs_uri_unref (vfs_uri);
if (strcmp (normalized_path, te_normalized_path) == 0) if (strcmp (normalized_path, te_normalized_path) == 0)
@@ -982,12 +984,9 @@ anjuta_docman_goto_file_line_mark (Anjut @@ -982,12 +988,9 @@
an_file_history_push (te_uri, lineno); an_file_history_push (te_uri, lineno);
g_free (uri); g_free (uri);
g_free (te_uri); g_free (te_uri);
@ -53,7 +59,7 @@
node = g_list_next (node); node = g_list_next (node);
} }
te = anjuta_docman_add_editor (docman, uri, NULL); te = anjuta_docman_add_editor (docman, uri, NULL);
@@ -1006,7 +1005,6 @@ anjuta_docman_goto_file_line_mark (Anjut @@ -1006,7 +1009,6 @@
} }
} }
g_free (uri); g_free (uri);