@@ -26,14 +26,9 @@ char *opt_set_talstr(const char *arg, char **p)
26
26
27
27
static char * opt_set_abspath (const char * arg , char * * p )
28
28
{
29
- char * ret ;
30
29
tal_free (* p );
31
-
32
- ret = opt_set_charp (path_join (options_ctx , take (path_cwd (NULL )), arg ),p );
33
- if (strlen (* p ) > OPT_SHOW_LEN )
34
- errx (EXITCODE_INVALID_PATH , "absolute path of command line option exceeds %d chars: '%s'" ,
35
- OPT_SHOW_LEN , * p );
36
- return ret ;
30
+ return opt_set_charp (path_join (options_ctx , take (path_cwd (NULL )), arg ),
31
+ p );
37
32
}
38
33
39
34
/* Tal wrappers for opt. */
@@ -43,6 +38,17 @@ static void *opt_allocfn(size_t size)
43
38
TAL_LABEL (opt_allocfn_notleak , "" ));
44
39
}
45
40
41
+ static void opt_show_longpath (char * buf , char * const * p )
42
+ {
43
+ if (* p ){
44
+ size_t len = strlen (* p );
45
+ buf [0 ] = '"' ;
46
+ strncpy (buf + 1 , * p , len );
47
+ buf [1 + len ] = '"' ;
48
+ buf [2 + len ] = '\0' ;
49
+ }
50
+ }
51
+
46
52
static void * tal_reallocfn (void * ptr , size_t size )
47
53
{
48
54
if (!ptr )
@@ -315,7 +321,7 @@ void initial_config_opts(const tal_t *ctx,
315
321
/* Cmdline can also set lightning-dir. */
316
322
* config_basedir = NULL ;
317
323
opt_register_early_arg ("--lightning-dir=<dir>" ,
318
- opt_set_abspath , NULL ,
324
+ opt_set_abspath , opt_show_longpath ,
319
325
config_basedir ,
320
326
"Set base directory: network-specific subdirectory is under here" );
321
327
@@ -336,7 +342,7 @@ void initial_config_opts(const tal_t *ctx,
336
342
/* If they set --conf it can still set --lightning-dir */
337
343
if (!* config_filename ) {
338
344
opt_register_early_arg ("--lightning-dir=<dir>" ,
339
- opt_restricted_forceconf_only , opt_show_charp ,
345
+ opt_restricted_forceconf_only , opt_show_longpath ,
340
346
config_basedir ,
341
347
"Set base directory: network-specific subdirectory is under here" );
342
348
} else {
0 commit comments