Kouhei Sutou
null+****@clear*****
Sun Feb 21 23:21:13 JST 2016
Kouhei Sutou 2016-02-21 23:21:13 +0900 (Sun, 21 Feb 2016) New Revision: e86ce2dc9047c5c2ba021f8b1e14ccd7c621e3e0 https://github.com/groonga/groonga/commit/e86ce2dc9047c5c2ba021f8b1e14ccd7c621e3e0 Message: object_remove: try to remove *.c when .c exists Modified files: lib/proc/proc_object.c Modified: lib/proc/proc_object.c (+7 -1) =================================================================== --- lib/proc/proc_object.c 2016-02-21 22:35:43 +0900 (541c7b3) +++ lib/proc/proc_object.c 2016-02-21 23:21:13 +0900 (cafb254) @@ -21,6 +21,9 @@ #include <groonga/plugin.h> +#include <sys/types.h> +#include <sys/stat.h> + static grn_obj * command_object_exist(grn_ctx *ctx, int nargs, @@ -101,11 +104,14 @@ command_object_remove(grn_ctx *ctx, GRN_TEXT_LEN(name)); if (id != GRN_ID_NIL) { char path[PATH_MAX]; + struct stat stat_buffer; grn_obj_delete_by_id(ctx, db, id, GRN_TRUE); grn_obj_path_by_id(ctx, db, id, path); grn_io_remove(ctx, path); grn_strcat(path, PATH_MAX, ".c"); - grn_io_remove(ctx, path); + if (stat(path, &stat_buffer) == 0) { + grn_io_remove(ctx, path); + } grn_ctx_output_bool(ctx, ctx->rc == GRN_SUCCESS); return NULL; } -------------- next part -------------- HTML����������������������������... Descargar