Re: kmheaders.cpp error message could be much more helpful

Matthew Toseland <[email protected]>
Newsgroups gmane.comp.kde.devel.kmail
Message-ID <[email protected]>
Sorry, that one will cause a null dereference. Attached a better one.
Will also say if I manage to compile it.

On Sat, May 05, 2007 at 03:02:08AM +0100, Matthew Toseland wrote:
> While trying to determine why kmail doesn't recognise new messages from
> Maildir folders on my system, I ran into the following error message:
> WARNING: Error: Failure modifying
> /home/toad/Mail/.debian.directory/.debian-openoffice.index.sorted (No
> space left on device?)
> 
> This is actually hardcoded almost in its entirety - "No space left on
> device?" is in particular a hardcoded string. It is however caused by a
> real error - the code is roughly if(fd && ferror(fd)) { complain }.
> 
> I have attached a patch to include the actual error code. Unfortunately
> I haven't been able to get the ******* kdepim to compile. This is
> probably my fault but I've spent several hours on it and not had much
> success.
> 
> Patch is against the debian stable package source (3.5.5). May not
> compile because I haven't been able to make kdepim compile. :|

_______________________________________________
KMail developers mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kmail-devel
error-message-kmheaders.cpp.diff (text/x-diff, 2.1 KB)
--- /root/kdepim-3.5.6.dfsg.1/kmail/kmheaders.cpp	2007-05-05 02:56:43.000000000 +0100
+++ /home/toad/kdepim-3.5.6.dfsg.1/kmail/kmheaders.cpp	2007-05-05 11:29:33.000000000 +0100
@@ -2658,9 +2658,10 @@
     fwrite(&discovered_count, sizeof(discovered_count), 1, sortStream);
     fwrite(&sorted_count, sizeof(sorted_count), 1, sortStream);
     if (sortStream && ferror(sortStream)) {
+    	int err = ferror(sortStream);
         fclose(sortStream);
         unlink(QFile::encodeName(sortFile));
-        kdWarning(5006) << "Error: Failure modifying " << sortFile << " (No space left on device?)" << endl;
+        kdWarning(5006) << "Error: Failure modifying " << sortFile << " (No space left on device? " << err << ")" << endl;
         kdWarning(5006) << __FILE__ << ":" << __LINE__ << endl;
         kmkernel->emergencyExit( i18n("Failure modifying %1\n(No space left on device?)").arg( sortFile ));
     }
@@ -2698,9 +2699,10 @@
     fseek(sortStream, KMAIL_MAGIC_HEADER_OFFSET + 16, SEEK_SET);
 
     if (sortStream && ferror(sortStream)) {
+    	int err = ferror(sortStream);
         fclose(sortStream);
         unlink(QFile::encodeName(sortFile));
-        kdWarning(5006) << "Error: Failure modifying " << sortFile << " (No space left on device?)" << endl;
+        kdWarning(5006) << "Error: Failure modifying " << sortFile << " (No space left on device? " << err << ")" << endl;
         kdWarning(5006) << __FILE__ << ":" << __LINE__ << endl;
         kmkernel->emergencyExit( i18n("Failure modifying %1\n(No space left on device?)").arg( sortFile ));
     }
@@ -3313,10 +3315,11 @@
     END_TIMER(selection);
     SHOW_TIMER(selection);
     if (error || (sortStream && ferror(sortStream))) {
+    	int err = ferror(sortStream);
         if ( sortStream )
             fclose(sortStream);
         unlink(QFile::encodeName(sortFile));
-        kdWarning(5006) << "Error: Failure modifying " << sortFile << " (No space left on device?)" << endl;
+        kdWarning(5006) << "Error: Failure modifying " << sortFile << " (No space left on device? " << err << " " << error << ")" << endl;
         kdWarning(5006) << __FILE__ << ":" << __LINE__ << endl;
 
         return true;
signature.asc (application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFGPF1PA9rUluQ9pFARAhL6AJ9WlWySDcu4CwwNPbjtT7CSjOvZowCfUQfO
kWGbM4zc4SJvyCSjgrwdrLA=
=IG+S
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.