57f0b5d904
While here: - remove quotes around COMMENT - change MAINTAINER's email - update patches - reformat dependencies/WANTLIB - don't use hardcoded patches in man and info pages based on a diff from Julian Leyh <julian at vgai dot de> (MAINTAINER)
40 lines
1.2 KiB
Plaintext
40 lines
1.2 KiB
Plaintext
$OpenBSD: patch-src_rename_c,v 1.2 2007/07/17 12:45:49 ajacoutot Exp $
|
|
--- src/rename.c.orig Thu Nov 16 15:59:14 2000
|
|
+++ src/rename.c Tue Jul 17 14:26:29 2007
|
|
@@ -28,6 +28,7 @@ static void cb_ok_button(GtkWidget *button,GtkWidget *
|
|
struct stat sbuf;
|
|
char *tn_src,*tn_dst;
|
|
char *dest=g_strdup(gtk_entry_get_text(GTK_ENTRY(entry)));
|
|
+int src_len,dst_len;
|
|
|
|
gtk_widget_destroy(rename_win);
|
|
|
|
@@ -64,8 +65,10 @@ if(rename(oldname,dest)==-1)
|
|
tn_src=tn_dst=NULL;
|
|
|
|
/* ".xvpics/" is 8 chars */
|
|
-if((tn_src=malloc(8+strlen(oldname)+1))==NULL ||
|
|
- (tn_dst=malloc(8+strlen(dest)+1))==NULL)
|
|
+src_len=8+strlen(oldname)+1;
|
|
+dst_len=8+strlen(dest)+1;
|
|
+if((tn_src=malloc(src_len))==NULL ||
|
|
+ (tn_dst=malloc(dst_len))==NULL)
|
|
{
|
|
/* rename entry */
|
|
gtk_clist_set_text(GTK_CLIST(clist),current_row,SELECTOR_NAME_COL,dest);
|
|
@@ -74,10 +77,10 @@ if((tn_src=malloc(8+strlen(oldname)+1))==NULL ||
|
|
return;
|
|
}
|
|
|
|
-strcpy(tn_src,".xvpics/");
|
|
-strcat(tn_src,oldname);
|
|
-strcpy(tn_dst,".xvpics/");
|
|
-strcat(tn_dst,dest);
|
|
+strlcpy(tn_src,".xvpics/",src_len);
|
|
+strlcat(tn_src,oldname,src_len);
|
|
+strlcpy(tn_dst,".xvpics/",dst_len);
|
|
+strlcat(tn_dst,dest,dst_len);
|
|
|
|
rename(tn_src,tn_dst); /* don't much care if it works or not */
|
|
|