int answer;
char *buf = new char[2048];
- sprintf(buf,
+ sprintf(buf, "%s",
GETMSG(DT_catd, 3, 81, "This attachment may contain commands that can cause serious\ndamage. It is recommended that you only execute it after you\nare certain it is safe to do so.\n\nPress OK if you are certain it is safe,\nCancel to cancel execution."));
answer = parent()->handleQuestionDialog(
/* NL_COMMENT
* Post a dialog explaining that the action was invalid
*/
- sprintf(buf,
+ sprintf(buf, "%s",
GETMSG(
DT_catd, 3, 91, "Cannot execute invalid action."));
/* NL_COMMENT
* Post a dialog explaining that the action failed.
*/
- sprintf(buf,
+ sprintf(buf, "%s",
GETMSG(DT_catd, 3, 92, "Executing action failed!"));
answer = parent()->handleErrorDialog(GETMSG(DT_catd, 1, 86, "Mailer"),
_FROM_MAILRC,
margin_keys[j].key,
DmxPrintOptions::isValidMarginSpec,
- (void*) margin_keys[j].which);
+ (void*) (intptr_t) margin_keys[j].which);
_propui_array->append(pui);
}
DtMailGenDialog *install_errDialog =
new DtMailGenDialog("Dialog", theApplication->baseWidget());
- sprintf(buf, GETMSG(DT_catd, 2, 4,
+ sprintf(buf, "%s", GETMSG(DT_catd, 2, 4,
"Mailer has not been properly installed,\n\
and cannot run because the execution group\n\
is incorrectly set."));
return (_vacation);
}
-char *formatPropPair(char * key, void * data)
+char *formatPropPair(char * key, const void * data)
{
char *formatted_str = NULL;
char *white_space = NULL;
+ strlen((char *)data) + strlen(" = ") + 1;
formatted_str = (char *)malloc(m_size);
- sprintf(formatted_str, "%s%s = %s",key, white_space, data);
+ sprintf(formatted_str, "%s%s = %s",key, white_space, (const char *) data);
}
else
{
/* make an alias string */
- formatted_str = (char *)malloc(key_len + strlen((char *)data) + 2);
+ formatted_str = (char *)malloc(key_len + strlen((const char *)data) + 2);
- m_size = key_len + strlen((char *)data) + strlen(" = ") + 1;
+ m_size = key_len + strlen((const char *)data) + strlen(" = ") + 1;
formatted_str = (char *)malloc(m_size);
- sprintf(formatted_str, "%s = %s",key, data);
+ sprintf(formatted_str, "%s = %s",key, (const char *) data);
}
~PropStringPair(void);
};
-char *formatPropPair(char * key, void * data);
+char *formatPropPair(char * key, const void * data);
void parsePropString(const char * input, DtVirtArray<PropStringPair *> & result);
char* getPropStringValue(DtVirtArray<PropStringPair *> &result, const char *value);
if (NULL == _roam_menu_window)
{
char *text_buf = _text_editor->get_contents();
- writeText((XtPointer) fd, text_buf);
+ writeText((XtPointer) (intptr_t) fd, text_buf);
XtFree((char*) text_buf);
}
else
next_msg->display(
visible_headers,
&SaveAsTextCmd::writeText,
- (XtPointer) fd);
- writeText((XtPointer) fd, "\n\n");
+ (XtPointer) (intptr_t) fd);
+ writeText((XtPointer) (intptr_t) fd, "\n\n");
} while ((next_msg = mailbox->nextMessage()) != (DmxMsg *) NULL);
delete mailbox;
renameDialog = aa->getRenameDialog();
- sprintf(buf, GETMSG(DT_catd, 3, 57, "Rename attachment as"));
+ sprintf(buf, "%s", GETMSG(DT_catd, 3, 57, "Rename attachment as"));
message = XmStringCreateLocalized(buf);
else
dialog = theRoamApp.genDialog();
- sprintf(error_buf, GETMSG(DT_catd, 1, 102, "You are already using the forwarding facility for\nsomething other than Vacation. While Vacation is\nrunning, Vacation will be appended to this other\nforwarding activity. Is it still OK to start Vacation?\0"));
+ sprintf(error_buf, "%s", GETMSG(DT_catd, 1, 102, "You are already using the forwarding facility for\nsomething other than Vacation. While Vacation is\nrunning, Vacation will be appended to this other\nforwarding activity. Is it still OK to start Vacation?\0"));
dialog->setToQuestionDialog(GETMSG(DT_catd, 1, 103, "Mailer"),
error_buf);
else
dialog = theRoamApp.genDialog();
- sprintf(error_buf, GETMSG(DT_catd, 1, 104, "You are already running the vacation program in your .forward file.\nConsult documentation on how to stop it and remove it from your .forward file.\nTry this command after fixing that problem.\0"));
+ sprintf(error_buf, "%s", GETMSG(DT_catd, 1, 104, "You are already running the vacation program in your .forward file.\nConsult documentation on how to stop it and remove it from your .forward file.\nTry this command after fixing that problem.\0"));
dialog->setToErrorDialog("Error", error_buf);
helpId = DTMAILHELPREMOVEVACATION;
char *buf = new char[BUFSIZ+1];
int fd;
- sprintf(buf, file);
+ sprintf(buf, "%s", file);
strcat(buf, _backupSuffix);
if (rename(buf, file) < 0) {
struct stat buf;
if (SafeFStat(fd, &buf) < 0) {
- sprintf(dialog_text,
+ sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 105, "Cannot open .vacation.msg file -- No write permission."));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPNOWRITEVACATION;
}
if (msg_file_exists >= 0 && text_changed) {
- sprintf(dialog_text,
+ sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 106, ".vacation.msg file exists. Replace with new text?"));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPEXISTSVACATION;
fd = SafeOpen(messagefile, O_WRONLY | O_CREAT);
if (fd < 0) {
- sprintf(dialog_text,
+ sprintf(dialog_text, "%s",
GETMSG(DT_catd, 1, 107, "Cannot open .vacation.msg file -- No write permission."));
dialog->setToQuestionDialog("Mailer", dialog_text);
helpId = DTMAILHELPERROR;
if (!this->baseWidget())
{
fprintf(
- stderr,
+ stderr, "%s",
GETMSG(DT_catd, 2, 3,
"Unable to initialize windows. Exiting.\n"));
exit(1);
else if ((DTMailError_t)error == DTME_BadRunGroup)
{
- sprintf(buf, GETMSG(DT_catd, 2, 4,
+ sprintf(buf, "%s", GETMSG(DT_catd, 2, 4,
"Mailer has not been properly installed,\n\
and cannot run because the execution group\n\
is incorrectly set."));
//
displayInCurrentWorkspace();
sprintf(
- buf,
+ buf, "%s",
GETMSG(DT_catd, 99, 99,"The INBOX path has changed.\nReopen?"));
_genDialog->setToQuestionDialog(
GETMSG(DT_catd, 3, 22, "Mailer"),
}
else {
buf = new char[2];
- sprintf(buf, "");
+ sprintf(buf, "%s", "");
labelStr = XmStringCreateLocalized(buf);
_clear_message_p = FALSE;
}
* There was an error in one or more of the email addresses.
* Ask the user to type in a valid address and try again.
*/
- sprintf(buf, GETMSG(DT_catd, 5, 5,
+ sprintf(buf, "%s", GETMSG(DT_catd, 5, 5,
"Some of the addresses in the message are incorrect,\n\
and do not refer to any known users in the system.\n\
Please make sure all of the addresses are valid and try again."));
* applications so there will be more memory available.
*/
- sprintf(buf, GETMSG(DT_catd, 5, 6,
+ sprintf(buf, "%s", GETMSG(DT_catd, 5, 6,
"Mailer does not have enough memory\n\
available to send this message.\n\
Try quitting other applications and\n\
* There was an error from the mail transport (sendmail).
*/
- sprintf(buf, GETMSG(DT_catd, 5, 7,
+ sprintf(buf, "%s", GETMSG(DT_catd, 5, 7,
"An error occurred while trying to send your message.\n\
Check to make sure the message was received. If not,\n\
you may have to resend this message."));
if (!this->hasAddressee()) {
// Message has no valid addressee. Pop up error dialog.
- sprintf(buf, GETMSG(DT_catd, 5, 8,
+ sprintf(buf, "%s", GETMSG(DT_catd, 5, 8,
"Try Send after specifying recipient(s) of the message in \nthe To:, Cc:, or Bcc: fields."));
helpId = DTMAILHELPNEEDADDRESSEE;
numPendingActions = attachArea->getNumPendingActions();
- sprintf(buf, GETMSG(
+ sprintf(buf, "%s", GETMSG(
DT_catd,
3,
77,
* Mailer ran out of memory. Ask the user to quit some other
* applications so there will be more memory available.
*/
- sprintf(buf, GETMSG(DT_catd, 5, 6,
+ sprintf(buf, "%s", GETMSG(DT_catd, 5, 6,
"Mailer does not have enough memory\n\
available to send this message.\n\
Try quitting other applications and\n\
if (attachArea->getIconSelectedCount() > 1) {
char *buf = new char[512];
- sprintf(buf, GETMSG(DT_catd, 5, 4, "Select only one attachment\n\
+ sprintf(buf, "%s", GETMSG(DT_catd, 5, 4, "Select only one attachment\n\
and then choose rename"));
_genDialog->setToQuestionDialog(
XtAddCallback(items[i], XmNvalueChangedCallback,
options_setting_chgCB, (XtPointer)dirty_bit);
XtAddCallback(items[i], XmNvalueChangedCallback,
- options_radiobox_itemCB, (XtPointer)item_values[i]);
+ options_radiobox_itemCB, (XtPointer) (intptr_t) item_values[i]);
/* Ensure Radiobox has a default Value set */
if (i == 0)
void
enableGroupPrivileges(void *)
{
- (void) setgid(_originalEgid);
+ if(-1 == setgid(_originalEgid)) {
+ fprintf(stderr, "Failed to enable group priviledges\n");
+ }
}
void
disableGroupPrivileges(void *)
{
- (void) setgid(_originalRgid);
+ if(-1 == setgid(_originalRgid)) {
+ fprintf(stderr, "Failed to disable group priviledges\n");
+ }
}
int
name = "(name)";
printf ("[%d] \"%s\"%s, ", i, name, description);
- printf ("%s, %d bytes\n", type, length);
+ printf ("%s, %lu bytes\n", type, length);
if (attbuf != NULL)
delete [] attbuf;
{
case MSGLIST:
sprintf (fbuf,
- "%-18.18s %-16.16s %4ld/%-5s %-.25s",
+ "%-18.18s %-16.16s %4d/%-5s %-.25s",
dispname (header [DMXFROM]),
header [DMXDATE],
atoi (header [DMXCLENGTH]) / 40,
va_end(var_args);
syslog(criticalError == DTM_TRUE ? LOG_CRIT|LOG_ERR : LOG_ERR,
- messageBuffer);
+ "%s", messageBuffer);
_DtSimpleError("libDtMail", criticalError == DTM_TRUE ? DtError : DtWarning,
NULL, messageBuffer);
+ strlen((char *)data) + strlen(" = ") + 1;
new_alias = (char *)malloc(m_size);
- sprintf(new_alias, "%s%s = %s",key, white_space, data);
+ sprintf(new_alias, "%s%s = %s",key, white_space, (char *) data);
}
else
m_size = key_len + strlen((char *)data) + strlen(" = ") + 1;
new_alias = (char *)malloc(m_size);
- sprintf(new_alias, "%s = %s",key, data);
+ sprintf(new_alias, "%s = %s",key, (char *) data);
}
delete [] dumpfilename;
}
- (void) fprintf(pfp_r, "--> %s (%d bytes at 0x%08lx):\n", pmsg, plen, pbufr);
+ (void) fprintf(pfp_r, "--> %s (%d bytes at %p):\n", pmsg, plen, pbufr);
fflush(pfp_r);
memset((char *)save, 0, sizeof(save));
save[0] = ~pbufr[0];
cnt = plen;
for (x = 0; cnt > 0; x++, z += 16)
{
- (void) fprintf(pfp_r, "0x%08lx(+%6.6ld) ", pbufr + z, z);
+ (void) fprintf(pfp_r, "%p(+%6.6ld) ", pbufr + z, z);
for (y = 0; y < 16; y++)
{
save[y] = pbufr[x * 16 + y];
pread(_fd, (void *)inbuf, 5, 0);
#else
lseek(_fd, (off_t) 0L, SEEK_SET);
- read(_fd, (void *)inbuf, 5);
+ if(-1 == read(_fd, (void *)inbuf, 5)) {
+ error.setError(DTME_NotMailBox);
+ return;
+ }
lseek(_fd, (off_t) 0L, SEEK_SET);
#endif
inbuf[5] = (char)0;
memset((void*) &ctime_buf, 0, sizeof(_Xctimeparams));
fprintf(df, "--------------------- pid=%ld %s",
(long)getpid(), _XCtime(&clockTime, ctime_buf));
- fprintf(df, str);
+ fprintf(df, "%s", str);
fprintf(df, "---------------------\n");
fprintf(df, "Mappings = %d\n", _mappings.length());
fprintf(df, "Map Entries:\n");
for (int m = 0; m < _mappings.length(); m++) {
MapRegion *map = _mappings[m];
- fprintf(df, "map[%d]: map_region = 0x%08lx, map_size = 0x%08lx(%08ld)\n",
+ fprintf(df, "map[%d]: map_region = %p, map_size = 0x%08lx(%08ld)\n",
m, map->map_region, map->map_size, map->map_size);
if (map->map_size % memoryPageSize()) {
- fprintf(df, "ERROR! map->map_size not mod %d\n", memoryPageSize());
+ fprintf(df, "ERROR! map->map_size not mod %lu\n", memoryPageSize());
}
HexDump(df, "map_region", (unsigned char *)map->map_region,
(int) map->file_size, _errorLogging ? 0 : 10);
fprintf(df,
- "map[%d]: file_region = 0x%08lx, file_size = 0x%08lx(%08ld)\n",
+ "map[%d]: file_region = %p, file_size = 0x%08lx(%08ld)\n",
m, map->file_region, map->file_size, map->file_size);
fprintf(df, "map[%d]: offset = 0x%08lx(%08ld)\n",
m, map->offset, map->offset);
total_file_size += (off_t) map->file_size;
if ((total_file_size % 4096) == 0) {
fprintf(df,
- "Total file size falls on page boundary, totalsize = %d\n",
+ "Total file size falls on page boundary, totalsize = %lu\n",
total_file_size);
}
}
- fprintf(df, "\nstat buffer entries: st_ino = %d, st_dev = %d, st_nlink = %d, st_size = %ld\n",
+ fprintf(df, "\nstat buffer entries: st_ino = %lu, st_dev = %lu, st_nlink = %lu, st_size = %ld\n",
buf.st_ino, buf.st_dev, buf.st_nlink, buf.st_size);
fprintf(df, "\n\n");
content_length = content_length < 0 ? 0 : content_length;
char buf[20];
- sprintf(buf, "%d", content_length);
+ sprintf(buf, "%lu", content_length);
_envelope->setHeader(error, "Content-Length", DTM_TRUE, buf);
return(real_end);
if (!content_type) {
char * new_bdry = (char *)malloc(78);
- sprintf(new_bdry, "%08lx-%08lx-%08lx", new_bdry, (long)time(NULL), &new_bdry);
+ sprintf(new_bdry, "%p-%08lx-%p", new_bdry, (long)time(NULL), &new_bdry);
}
// We will need the boundary to find the message boundaries.