plugins/mod_posix.lua
changeset 3029 0c7beabfed5b
parent 3022 948d511f479c
parent 3028 e095d2a98936
child 3340 0769cc5f34b6
equal deleted inserted replaced
3022:948d511f479c 3029:0c7beabfed5b
    80 	if pidfile_handle then
    80 	if pidfile_handle then
    81 		remove_pidfile();
    81 		remove_pidfile();
    82 	end
    82 	end
    83 	pidfile = module:get_option("pidfile");
    83 	pidfile = module:get_option("pidfile");
    84 	if pidfile then
    84 	if pidfile then
       
    85 		local err;
    85 		local mode = stat(pidfile) and "r+" or "w+";
    86 		local mode = stat(pidfile) and "r+" or "w+";
    86 		pidfile_handle, err = io.open(pidfile, mode);
    87 		pidfile_handle, err = io.open(pidfile, mode);
    87 		if not pidfile_handle then
    88 		if not pidfile_handle then
    88 			module:log("error", "Couldn't write pidfile at %s; %s", pidfile, err);
    89 			module:log("error", "Couldn't write pidfile at %s; %s", pidfile, err);
    89 			prosody.shutdown("Couldn't write pidfile");
    90 			prosody.shutdown("Couldn't write pidfile");