* mu: initialize randomness in mu-cmd-server

This commit is contained in:
djcb 2013-10-20 16:57:00 +03:00
parent c171a61827
commit 9ddb7510b9
1 changed files with 7 additions and 2 deletions

View File

@ -22,12 +22,15 @@
#include "config.h" #include "config.h"
#endif /*HAVE_CONFIG_H*/ #endif /*HAVE_CONFIG_H*/
#define _BSD_SOURCE
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <errno.h> #include <errno.h>
#include <stdarg.h> #include <stdarg.h>
#include <sys/time.h>
#include <glib/gprintf.h> #include <glib/gprintf.h>
@ -1145,7 +1148,8 @@ do_move (MuStore *store, unsigned docid, MuMsg *msg, const char *maildir,
different_mdir = different_mdir =
(g_strcmp0 (maildir, mu_msg_get_maildir(msg)) != 0); (g_strcmp0 (maildir, mu_msg_get_maildir(msg)) != 0);
if (!mu_msg_move_to_maildir (msg, maildir, flags, TRUE, new_name, err)) if (!mu_msg_move_to_maildir (msg, maildir, flags, TRUE,
new_name, err))
return MU_G_ERROR_CODE (err); return MU_G_ERROR_CODE (err);
/* after mu_msg_move_to_maildir, path will be the *new* path, /* after mu_msg_move_to_maildir, path will be the *new* path,
@ -1529,7 +1533,6 @@ handle_args (ServerContext *ctx, GHashTable *args, GError **err)
{ "view", cmd_view } { "view", cmd_view }
}; };
cmd = g_hash_table_lookup (args, "cmd"); cmd = g_hash_table_lookup (args, "cmd");
/* ignore empty */ /* ignore empty */
@ -1561,6 +1564,8 @@ mu_cmd_server (MuStore *store, MuConfig *opts/*unused*/, GError **err)
if (!ctx.query) if (!ctx.query)
return MU_G_ERROR_CODE (err); return MU_G_ERROR_CODE (err);
srand (time(NULL)*getpid());
install_sig_handler (); install_sig_handler ();
g_print (";; welcome to " PACKAGE_STRING "\n"); g_print (";; welcome to " PACKAGE_STRING "\n");