rhythmbox r6286 - in trunk: . plugins/ipod
- From: teuf svn gnome org
- To: svn-commits-list gnome org
- Subject: rhythmbox r6286 - in trunk: . plugins/ipod
- Date: Sun, 12 Apr 2009 07:56:35 +0000 (UTC)
Author: teuf
Date: Sun Apr 12 07:56:35 2009
New Revision: 6286
URL: http://svn.gnome.org/viewvc/rhythmbox?rev=6286&view=rev
Log:
2009-04-12 Christophe Fergeau <cfergeau mandriva com>
patch by: Robert Ancell <robert ancell gmail com>
* plugins/ipod/rb-ipod-source.c: try harder to build a unique
filename when writing to the iPod by adding a random suffix to
filenames when we have to truncate them. Fixes bug #570600.
Modified:
trunk/ChangeLog
trunk/plugins/ipod/rb-ipod-source.c
Modified: trunk/plugins/ipod/rb-ipod-source.c
==============================================================================
--- trunk/plugins/ipod/rb-ipod-source.c (original)
+++ trunk/plugins/ipod/rb-ipod-source.c Sun Apr 12 07:56:35 2009
@@ -1329,15 +1329,22 @@
g_free (dirname);
if (strlen (result) >= IPOD_MAX_PATH_LEN) {
- char *ext;
+ char *ext, *suffix;
ext = strrchr (result, '.');
if (ext == NULL) {
+ suffix = result + IPOD_MAX_PATH_LEN - 4;
result [IPOD_MAX_PATH_LEN - 1] = '\0';
} else {
+ suffix = result + IPOD_MAX_PATH_LEN - 4 - strlen(ext);
memmove (&result[IPOD_MAX_PATH_LEN - strlen (ext) - 1] ,
ext, strlen (ext) + 1);
}
+
+ /* Add suffix to reduce the chance of a name collision with truncated name */
+ suffix[0] = '~';
+ suffix[1] = 'A' + g_random_int_range (0, 26);
+ suffix[2] = 'A' + g_random_int_range (0, 26);
}
tmp = g_build_filename (mount_point, result, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]