| Server IP : 82.208.35.60 / Your IP : 216.73.216.238 Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31 System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64 User : studiokobylisy_cz ( 1008) PHP Version : 7.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /usr/ports/devel/linenoise-ng/files/ |
Upload File : |
--- src/linenoise.cpp 2015-11-25 01:30:22.000000000 -0800
+++ /tmp/linenoise.cpp 2017-02-17 10:10:37.354285000 -0800
@@ -105,6 +105,7 @@
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <cctype>
@@ -3093,10 +3094,17 @@
/* Save the history in the specified file. On success 0 is returned
* otherwise -1 is returned. */
int linenoiseHistorySave(const char* filename) {
+#ifndef _WIN32
+ mode_t old_umask = umask(S_IXUSR|S_IRWXG|S_IRWXO);
+#endif
FILE* fp = fopen(filename, "wt");
if (fp == NULL) {
return -1;
}
+#ifndef _WIN32
+ umask(old_umask);
+ chmod(filename,S_IRUSR|S_IWUSR);
+#endif
for (int j = 0; j < historyLen; ++j) {
if (history[j][0] != '\0') {