]> granicus.if.org Git - liblinear/commitdiff
Error out when we can not save the model. This happens if one saves model
authorrafan <rafan@16e7d947-dcc2-db11-b54a-0017319806e7>
Sat, 10 Apr 2010 06:13:08 +0000 (06:13 +0000)
committerrafan <rafan@16e7d947-dcc2-db11-b54a-0017319806e7>
Sat, 10 Apr 2010 06:13:08 +0000 (06:13 +0000)
under a subdirectory without creating it first.

train.c

diff --git a/train.c b/train.c
index a33b50137e9237a0bd865dcbed9edd8eead39e6c..d6183ba2450c125ba8163f652f41beded8a9d7fe 100644 (file)
--- a/train.c
+++ b/train.c
@@ -104,7 +104,11 @@ int main(int argc, char **argv)
        else
        {
                model_=train(&prob, &param);
-               save_model(model_file_name, model_);
+               if(save_model(model_file_name, model_))
+               {
+                       fprintf(stderr,"can't save model to file %s\n",model_file_name);
+                       exit(1);
+               }
                destroy_model(model_);
        }
        destroy_param(&param);