TL;DR: please change "close(lockfile); sync()" in locking.c to "fsync(lockfile); close(lockfile)".
I just spent many hours chasing down why it was taking SMS tools up to 20 minutes to send a message. It turned out to be because zoneminder (an camera monitoring package) was running on the same machine, and zoneminder was the copious amounts of video data it generates to a USB HDD, which apparently was having issues.
Smstools wasn't using the USB drive in any way, but it does call sync() in locking.c. sync() syncs all drives attached to the machine and does not return until it's done. It turns out it was taking up to 20 minutes to write the buffered video data to this USB drive.
AFAICT there is no reason to do the sync at all. The only reason you do it is to ensure the data is on the disk before telling the user the operation is done, so that if the power fails the user is assured his data is safe. But in this case the thing being synced is a lock file which is deleted on boot, so if the power fails no one will care if it was saved or not. (To contrast, syncing a received SMS to disk before calling the event handler would make some sense). If you insist on sync()'ing it you should use fsync() wish only flushes the data you care about - and doesn't put the performance of your application at the mercy of every other thing the machine is doing at the time.