Skip to content

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
diff --git a/src/itdb_artwork.c b/src/itdb_artwork.c
index c595d70..14dc960 100644
--- a/src/itdb_artwork.c
+++ b/src/itdb_artwork.c
@@ -653,7 +653,7 @@ get_pixel_data (Itdb_Device *device, Itdb_Thumb_Ipod_Item *thumb)
goto error;
}
- f = fopen (filename, "r");
+ f = fopen (filename, "rb");
if (f == NULL) {
g_print ("Failed to open %s: %s\n",
filename, strerror (errno));
diff --git a/src/itdb_device.c b/src/itdb_device.c
index 6f1bc0b..c72dd45 100644
--- a/src/itdb_device.c
+++ b/src/itdb_device.c
@@ -1047,7 +1047,7 @@ gboolean itdb_device_read_sysinfo (Itdb_Device *device)
gchar *ptr;
gint len = strlen (buf);
/* suppress newline at end of line */
- if ((len>0) && (buf[len-1]==0x0a))
+ if ((len>0) && (buf[len-1]==0x0a || buf[len-1]==0x0d))
{
buf[len-1] = 0;
--len;
@@ -1108,7 +1108,7 @@ gboolean itdb_device_write_sysinfo (Itdb_Device *device, GError **error)
if (devicedir)
{
gchar *sysfile = g_build_filename (devicedir, "SysInfo", NULL);
- FILE *sysinfo = fopen (sysfile, "w");
+ FILE *sysinfo = fopen (sysfile, "wb");
if (sysinfo)
{
if (device->sysinfo)
@@ -1538,7 +1538,7 @@ static guint endianess_check_path (const gchar *path, const gchar *hdr)
if (path)
{
- int fd = open (path, O_RDONLY);
+ int fd = open (path, O_RDONLY | O_BINARY);
if (fd != -1)
{
gchar buf[4];
diff --git a/src/itdb_tzinfo.c b/src/itdb_tzinfo.c
index 3c29947..a34eb36 100644
--- a/src/itdb_tzinfo.c
+++ b/src/itdb_tzinfo.c
@@ -98,7 +98,7 @@ static gboolean itdb_device_read_raw_timezone (const char *prefs_path,
return FALSE;
}
- f = fopen (prefs_path, "r");
+ f = fopen (prefs_path, "rb");
if (f == NULL) {
return FALSE;
}
diff --git a/src/ithumb-writer.c b/src/ithumb-writer.c
index 6b47aa6..a1e8dae 100644
--- a/src/ithumb-writer.c
+++ b/src/ithumb-writer.c
@@ -1262,7 +1262,7 @@ static gboolean ithumb_rearrange_thumbnail_file (gpointer _key,
goto out;
}
- fd = open (filename, O_RDWR, 0);
+ fd = open (filename, O_RDWR | O_BINARY, 0);
if (fd == -1)
{
*result = FALSE;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.