[uim-commit] r134 - trunk/uim
ekato@freedesktop.org
ekato@freedesktop.org
Thu Jan 6 00:03:35 PST 2005
Author: ekato
Date: 2005-01-06 00:03:32 -0800 (Thu, 06 Jan 2005)
New Revision: 134
Modified:
trunk/uim/uim.c
Log:
* uim/uim.c (load_conf) : Fix r127 and r128 bug.
Modified: trunk/uim/uim.c
===================================================================
--- trunk/uim/uim.c 2005-01-06 07:24:13 UTC (rev 133)
+++ trunk/uim/uim.c 2005-01-06 08:03:32 UTC (rev 134)
@@ -34,7 +34,7 @@
#include <pwd.h>
#include <unistd.h>
#include <sys/types.h>
-#include <stdio.h>
+#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
#include "config.h"
@@ -503,17 +503,11 @@
struct passwd *pw;
char *fn;
long verbose, ret;
- FILE *fp;
+ struct stat st;
verbose = uim_scm_get_verbose_level();
fn = getenv("LIBUIM_USER_SCM_FILE");
- fp = fopen(fn, "r");
- if (!fp) {
- return -1;
- }
- fclose(fp);
-
if (!fn) {
pw = getpwuid(getuid());
fn = malloc(strlen(pw->pw_dir) + sizeof("/.uim"));
@@ -522,6 +516,11 @@
fn = strdup(fn);
}
+ if (stat(fn, &st) == -1) {
+ free(fn);
+ return -1;
+ }
+
if (verbose < 1) {
uim_scm_set_verbose_level(1); /* to show error message */
}
More information about the Uim-commit
mailing list