Search
lxdream.org :: lxdream :: r1056:d0896e6530d6
lxdream 0.9.1
released Jun 29
Download Now
changeset1056:d0896e6530d6
parent1055:072457c02704
child1057:6f2158c421bb
authornkeynes
dateSun Jun 28 12:07:21 2009 +0000 (11 years ago)
Fix handling of rename failure
Fix boneheadedness in get_filename_at
src/lxpaths.c
src/vmu/vmuvol.c
1.1 --- a/src/lxpaths.c Sun Jun 28 10:39:51 2009 +0000
1.2 +++ b/src/lxpaths.c Sun Jun 28 12:07:21 2009 +0000
1.3 @@ -120,12 +120,12 @@
1.4 gchar *get_filename_at( const gchar *at, const gchar *filename )
1.5 {
1.6 char tmp[PATH_MAX];
1.7 - char *p = strrchr( filename, '/' );
1.8 + char *p = strrchr( at, '/' );
1.9 if( p == NULL ) {
1.10 /* No path at all, so just return filename */
1.11 return g_strdup(filename);
1.12 } else {
1.13 - int off = p-filename;
1.14 + int off = p-at;
1.15 return g_strdup_printf("%.*s%c%s", off, at, G_DIR_SEPARATOR, filename );
1.16 }
1.17 }
2.1 --- a/src/vmu/vmuvol.c Sun Jun 28 10:39:51 2009 +0000
2.2 +++ b/src/vmu/vmuvol.c Sun Jun 28 12:07:21 2009 +0000
2.3 @@ -239,6 +239,7 @@
2.4 fseek( f, end, SEEK_SET );
2.5 }
2.6 fclose(f);
2.7 + f = NULL;
2.8
2.9 if( rename(tempfile, filename) != 0 )
2.10 goto cleanup;
2.11 @@ -249,7 +250,8 @@
2.12 return TRUE;
2.13
2.14 cleanup:
2.15 - fclose(f);
2.16 + if( f != NULL )
2.17 + fclose(f);
2.18 unlink(tempfile);
2.19 g_free(tempfile);
2.20 return FALSE;
.