aboutsummaryrefslogtreecommitdiffstats
path: root/src/libid3tag/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libid3tag/file.c')
-rw-r--r--src/libid3tag/file.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/libid3tag/file.c b/src/libid3tag/file.c
index 02150c06b..9d7319a76 100644
--- a/src/libid3tag/file.c
+++ b/src/libid3tag/file.c
@@ -1,6 +1,6 @@
/*
* libid3tag - ID3 tag manipulation library
- * Copyright (C) 2000-2003 Underbit Technologies, Inc.
+ * Copyright (C) 2000-2004 Underbit Technologies, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -16,7 +16,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
- * $Id: file.c,v 1.1 2003/08/14 03:57:13 shank Exp $
+ * $Id: file.c,v 1.21 2004/01/23 09:41:32 rob Exp $
*/
# ifdef HAVE_CONFIG_H
@@ -522,7 +522,7 @@ int v1_write(struct id3_file *file,
if (fseek(file->iofile, (file->flags & ID3_FILE_FLAG_ID3V1) ? -128 : 0,
SEEK_END) == -1 ||
(location = ftell(file->iofile)) == -1 ||
- fwrite(data, 128, 1, file->iofile) == 0 ||
+ fwrite(data, 128, 1, file->iofile) != 1 ||
fflush(file->iofile) == EOF)
return -1;
@@ -577,13 +577,14 @@ int v2_write(struct id3_file *file,
{
assert(!data || length > 0);
- if (((file->ntags == 1 && !(file->flags & ID3_FILE_FLAG_ID3V1)) ||
+ if (data &&
+ ((file->ntags == 1 && !(file->flags & ID3_FILE_FLAG_ID3V1)) ||
(file->ntags == 2 && (file->flags & ID3_FILE_FLAG_ID3V1))) &&
file->tags[0].length == length) {
/* easy special case: rewrite existing tag in-place */
if (fseek(file->iofile, file->tags[0].location, SEEK_SET) == -1 ||
- fwrite(data, length, 1, file->iofile) == 0 ||
+ fwrite(data, length, 1, file->iofile) != 1 ||
fflush(file->iofile) == EOF)
return -1;