* details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
char * buf = new char[25];
- sprintf(buf, "Converted: %3d%", 0);
+ sprintf(buf, "Converted: %3d%%", 0);
_dialog->post ("Mailer",
buf,
// If a string was successfully extracted, call
// unifiedMailboxSelected to handle the file.
*selected = '\0';
- if (NULL != dname) strcat(selected, dname);
+ if (NULL != dname) snprintf(selected, sizeof(selected), "%s", dname);
strcat(selected, fname);
obj->updateUnifiedData();
obj->unifiedMailboxSelected(
DebugPrintf(1, "%s: printit\n", name());
// Create tmp file.
- sprintf(tmpdir, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
+ snprintf(tmpdir, MAXPATHLEN+1, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
if ((p = tempnam(tmpdir, "dtmail")) == NULL) {
delete [] tmpdir;
return;
// Create temp file.
//
char *tmpdir = new char[MAXPATHLEN+1];
- sprintf(tmpdir, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
+ snprintf(tmpdir, MAXPATHLEN+1, "%s/%s", getenv("HOME"), DtPERSONAL_TMP_DIRECTORY);
if ((tmppath = tempnam(tmpdir, "dtmail")) == NULL) {
- sprintf(buf, GETMSG(DT_catd, 3, 51, "Unable to create %s."), tmpdir);
+ snprintf(buf, sizeof(buf), GETMSG(DT_catd, 3, 51, "Unable to create %s."), tmpdir);
_genDialog->setToErrorDialog(GETMSG(DT_catd, 3, 52, "Mailer"), buf);
helpId = DTMAILHELPNOCREATE;
_genDialog->post_and_return(helpId);
{
char *forwardfile = new char[MAXPATHLEN+1];
- sprintf(forwardfile, "%s/%s", getenv("HOME"), _forwardFile);
+ snprintf(forwardfile, MAXPATHLEN+1, "%s/%s", getenv("HOME"), _forwardFile);
// Remove the current .forward file (it has vacation in it)
// Recover and replace the original backup forward file, if
Boolean retval = FALSE;
char *forwardfile = new char[MAXPATHLEN+1];
- sprintf(forwardfile, "%s/%s", getenv("HOME"), _forwardFile);
+ snprintf(forwardfile, MAXPATHLEN+1, "%s/%s", getenv("HOME"), _forwardFile);
if (SafeAccess(forwardfile, F_OK) != 0) {
delete [] forwardfile;
delete [] messagefile;
delete [] error_buf;
delete [] forwardfile;
+ SafeClose(bkup_fd);
SafeClose(fwd_fd);
return 1;
}
strlen(append_buf2)) {
// error
SafeClose(bkup_fd);
+ SafeClose(fwd_fd);
delete [] buf;
delete [] messagefile;
delete [] error_buf;
return(-1);
}
- if ((fd = SafeOpen(file, O_RDONLY)) == 0) {
+ if ((fd = SafeOpen(file, O_RDONLY)) == -1) {
delete [] buf;
return(-1);
}
size_t map_size = (int) (buf.st_size +
(page_size - (buf.st_size % page_size)));
- if (buf.st_size == 0)
+ if (buf.st_size == 0) {
+ SafeClose(fd);
return;
+ }
int free_buf = 0;
mbuf.size = buf.st_size;
-#ifdef __osf__
- mbuf.buffer = (char *)mmap(0, map_size, PROT_READ, MAP_PRIVATE, fd, 0);
-#else
mbuf.buffer = mmap(0, map_size, PROT_READ, MAP_PRIVATE, fd, 0);
-#endif
if (mbuf.buffer == (char *)-1) {
free_buf = 1;
mbuf.buffer = new char[mbuf.size];