Skip to content

Instantly share code, notes, and snippets.

@kazuho
Created October 25, 2023 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kazuho/453311b4fba9b4c987a7edc7fe0ae7e4 to your computer and use it in GitHub Desktop.
Save kazuho/453311b4fba9b4c987a7edc7fe0ae7e4 to your computer and use it in GitHub Desktop.
diff --git a/src-main/context.c b/src-main/context.c
index d84858c..08a0de5 100644
--- a/src-main/context.c
+++ b/src-main/context.c
@@ -594,7 +594,7 @@ anthy_save_history(const char *fn, struct anthy_context *ac)
dprintf(fd, "\n");
/**/
errno = 0;
- if (fchmod(fd, S_IREAD | S_IWRITE)) {
+ if (fchmod(fd, S_IRUSR | S_IWUSR)) {
anthy_log(0, "Failed chmod in %s:%d: %s\n",
__FILE__, __LINE__, anthy_strerror(errno));
}
diff --git a/src-worddic/priv_dic.c b/src-worddic/priv_dic.c
index 3c3c268..390d43f 100644
--- a/src-worddic/priv_dic.c
+++ b/src-worddic/priv_dic.c
@@ -174,7 +174,7 @@ anthy_priv_dic_lock(void)
}
/* ファイルロックの方法は多数あるが、この方法はcygwinでも動くので採用した */
- lock_fd = open(lock_fn, O_CREAT|O_RDWR, S_IREAD|S_IWRITE);
+ lock_fd = open(lock_fn, O_CREAT|O_RDWR, S_IRUSR|S_IWUSR);
if (lock_fd == -1) {
return ;
}
diff --git a/test/check.c b/test/check.c
index 24163ca..cc5cc81 100644
--- a/test/check.c
+++ b/test/check.c
@@ -88,12 +88,12 @@ test1(void)
static long int
compliant_rand(void)
{
- struct timespec ts = { 0, };
- if (!timespec_get (&ts, TIME_UTC)) {
+ struct timeval ts = { 0, };
+ if (!gettimeofday (&ts, NULL)) {
printf("Failed timespec_get\n");
assert(0);
}
- return ts.tv_nsec;
+ return ts.tv_usec;
}
static int
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment