Hi, David

Could you please help review this patch
See https://bugs.open64.net/show_bug.cgi?id=709

In revision 3437 , the function want_directory has been remove
considering it's a dead function, but it's not true. This function
will always return TRUE no matter the path is a directory or not.
If it's replace with is_directory, the following situation will fail .

There is no directory named libs
$ opencc -I ./libs  test.c
opencc WARNING: unknown flag: -I
gcc: ./libs: No such file or directory


Here is the patch.
Index: osprey/driver/file_utils.c
===================================================================
--- osprey/driver/file_utils.c  (revision 3437)
+++ osprey/driver/file_utils.c  (working copy)
@@ -163,6 +163,13 @@
                return FALSE;
 }

+boolean want_directory (char *path)
+{
+  if (is_directory(path) && fullwarn)
+    warning("%s is not a directory", path);
+  return TRUE;
+}
+
 /* check if directory is writable */
 boolean
 directory_is_writable (char *path)
Index: osprey/driver/file_utils.h
===================================================================
--- osprey/driver/file_utils.h  (revision 3437)
+++ osprey/driver/file_utils.h  (working copy)
@@ -61,6 +61,9 @@
 /* check whether is a directory */
 extern boolean is_directory (char *path);

+/* check whether is a directory */
+extern boolean want_directory (char *path);
+
 /* check whether directory is writable */
 extern boolean directory_is_writable (char *path);

Index: osprey/driver/table.c
===================================================================
--- osprey/driver/table.c       (revision 3437)
+++ osprey/driver/table.c       (working copy)
@@ -827,7 +827,7 @@
                                   || options[i].syntax ==
needs_directory_or_null
 #endif
                                   ) {
-                               fprintf(f, "\tif
(is_directory(next_string(argv,argi))) {\n");
+                               fprintf(f, "\tif
(want_directory(next_string(argv,argi))) {\n");
                        }
                        fprintf(f, "\t\toptargs = get_optarg(argv, argi);\n");
                        if (options[i].syntax == needs_decimal) {


-- 
yongchong

------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Open64-devel mailing list
Open64-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/open64-devel

Reply via email to