GNOME Bugzilla – Bug 311072
Patch to fix crashes in expense conduit
Last modified: 2006-06-19 00:04:50 UTC
Version details: gnome-pilot-conduits-2.0.13-1 Distribution/Version: Fedora Core 4 While working on getting gnome-pilot-conduits in FC4 updated to work with the shipped pilot-link (see bug #274032), I ran into a crash in the expense conduit. It turns out that there are two bugs here. 1) the check for the directory being set isn't sufficient, as the dialog box sets an empty string, but we only check for NULL 2) if an error occurs (such as while calling mkdir), we try to close the array of opened file descriptors... except they've not yet been opened or even initialized The attached patch fixes both of those bugs. A changelog entry is also attached.
Created attachment 49492 [details] [review] Fix two bugs in expense conduit
Created attachment 49493 [details] [review] Changelog entry
Couple things, to replace the magic number, I'd prefer a #define. Not only should the empty string be tested, but the conduit should also create a default directory in configuration like memo_file does.
The magic number 17 dates from revision 1.1. The number is based on the number of categories, which as far as I can tell is, and has always been, 16. The extra one was being used as an 'Archived' class, but from looking at the code it seems it was never implemented as a feature, so I've dropped it. pi-appinfo.h doesn't supply a #define for the number of categories, so I've just commented where the magic number comes from. Yes, the capplet should be doing more work checking arguments, creating the directory, etc. etc., but we'd still have to check args at runtime in case someone was upgrading or had edited the config file directly... So I've committed the patch to prevent the worst crasher effects. I have now tested that backup, expense, memo_file, sendmail, file, and mal conduits all seem to work under 0.12.0.