Changeset: b1b9a95d0229 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/b1b9a95d0229
Modified Files:
        tools/mserver/mserver5.c
Branch: Dec2025
Log Message:

Fix option --dbextra=in-memory: fix regression.


diffs (61 lines):

diff --git a/tools/mserver/mserver5.c b/tools/mserver/mserver5.c
--- a/tools/mserver/mserver5.c
+++ b/tools/mserver/mserver5.c
@@ -327,6 +327,7 @@ main(int argc, char **av)
        char *dbtrace = NULL;
        bool inmemory = false;
        bool readpwdxit = false;
+       static const char in_memory[] = "in-memory";
        static const struct option long_options[] = {
                {"config", required_argument, NULL, 'c'},
                {"dbextra", required_argument, NULL, 0},
@@ -450,7 +451,7 @@ main(int argc, char **av)
                                break;
                        }
 #endif
-                       if (strcmp(long_options[option_index].name, 
"in-memory") == 0) {
+                       if (strcmp(long_options[option_index].name, in_memory) 
== 0) {
                                inmemory = true;
                                break;
                        }
@@ -481,21 +482,25 @@ main(int argc, char **av)
                                                        "#warning: ignoring 
multiple --dbextra arguments\n");
                                        break;
                                }
-                               size_t optarglen = strlen(optarg);
-                               /* remove trailing directory separator */
-                               while (optarglen > 0
-                                          && (optarg[optarglen - 1] == '/'
-                                                  || optarg[optarglen - 1] == 
'\\'))
-                                       optarg[--optarglen] = '\0';
-                               dbextra = absolute_path(optarg);
-                               if (dbextra == NULL) {
-                                       fprintf(stderr,
-                                                       "#error: can not 
allocate memory for dbextra\n");
-                                       exit(1);
-                               }
-                               if (strlen(dbextra) >= FILENAME_MAX - 45) {
-                                       fprintf(stderr, "#error: dbextra name 
too long\n");
-                                       exit(1);
+                               if (strcmp(optarg, in_memory) == 0) {
+                                       dbextra = (char *) in_memory;
+                               } else {
+                                       size_t optarglen = strlen(optarg);
+                                       /* remove trailing directory separator 
*/
+                                       while (optarglen > 0
+                                                  && (optarg[optarglen - 1] == 
'/'
+                                                          || optarg[optarglen 
- 1] == '\\'))
+                                               optarg[--optarglen] = '\0';
+                                       dbextra = absolute_path(optarg);
+                                       if (dbextra == NULL) {
+                                               fprintf(stderr,
+                                                               "#error: can 
not allocate memory for dbextra\n");
+                                               exit(1);
+                                       }
+                                       if (strlen(dbextra) >= FILENAME_MAX - 
45) {
+                                               fprintf(stderr, "#error: 
dbextra name too long\n");
+                                               exit(1);
+                                       }
                                }
                                break;
                        }
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to