Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
ccan
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mirror
ccan
Commits
d98e77e5
Commit
d98e77e5
authored
Sep 27, 2018
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tools: fix compile after rbuf rewrite.
Signed-off-by:
Rusty Russell
<
rusty@rustcorp.com.au
>
parent
d8a270fd
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
Makefile
Makefile
+1
-1
tools/depends.c
tools/depends.c
+5
-3
tools/tools.c
tools/tools.c
+8
-6
tools/tools.h
tools/tools.h
+1
-1
No files found.
Makefile
View file @
d98e77e5
...
...
@@ -46,7 +46,7 @@ config.h: $(CONFIGURATOR) Makefile
TOOLS
:=
tools/ccan_depends tools/doc_extract tools/namespacize tools/modfiles
TOOLS_SRCS
:=
$(
filter-out
$(TOOLS:%=%.c)
,
$(
wildcard
tools/
*
.c
))
TOOLS_DEPS
:=
$(TOOLS_SRCS:%.c=%.d)
$(TOOLS:%=%.d)
TOOLS_CCAN_MODULES
:=
asort err foreach
hash
htable list noerr opt rbuf
\
TOOLS_CCAN_MODULES
:=
asort err foreach
hash
htable list
membuf
noerr opt rbuf
\
read_write_all str take tal tal/grab_file tal/link tal/path tal/str
time
TOOLS_CCAN_SRCS
:=
$(
wildcard
$
(
TOOLS_CCAN_MODULES:%
=
ccan/%/
*
.c
))
TOOLS_OBJS
:=
$(TOOLS_SRCS:%.c=%.o)
$(TOOLS_CCAN_SRCS:%.c=%.o)
...
...
tools/depends.c
View file @
d98e77e5
...
...
@@ -20,6 +20,7 @@ lines_from_cmd(const void *ctx, const char *format, ...)
char
*
cmd
;
FILE
*
p
;
struct
rbuf
in
;
char
*
str
;
va_start
(
ap
,
format
);
cmd
=
tal_vfmt
(
ctx
,
format
,
ap
);
...
...
@@ -30,12 +31,13 @@ lines_from_cmd(const void *ctx, const char *format, ...)
err
(
1
,
"Executing '%s'"
,
cmd
);
/* FIXME: Use rbuf_read_str(&in, '\n') rather than strsplit! */
rbuf_init
(
&
in
,
fileno
(
p
),
tal_arr
(
ctx
,
char
,
0
),
0
);
if
(
!
rbuf_read_str
(
&
in
,
0
,
do_tal_realloc
)
&&
errno
)
rbuf_init
(
&
in
,
fileno
(
p
),
tal_arr
(
ctx
,
char
,
0
),
0
,
membuf_tal_realloc
);
str
=
rbuf_read_str
(
&
in
,
0
);
if
(
!
str
)
err
(
1
,
"Reading from '%s'"
,
cmd
);
pclose
(
p
);
return
tal_strsplit
(
ctx
,
in
.
buf
,
"
\n
"
,
STR_EMPTY_OK
);
return
tal_strsplit
(
ctx
,
str
,
"
\n
"
,
STR_EMPTY_OK
);
}
/* Be careful about trying to compile over running programs (parallel make).
...
...
tools/tools.c
View file @
d98e77e5
...
...
@@ -40,6 +40,7 @@ char *run_with_timeout(const void *ctx, const char *cmd,
struct
rbuf
in
;
int
status
,
ms
;
struct
timeabs
start
;
const
char
*
ret
;
*
ok
=
false
;
if
(
pipe
(
p
)
!=
0
)
...
...
@@ -82,9 +83,10 @@ char *run_with_timeout(const void *ctx, const char *cmd,
}
close
(
p
[
1
]);
rbuf_init
(
&
in
,
p
[
0
],
tal_arr
(
ctx
,
char
,
4096
),
4096
);
if
(
!
rbuf_read_str
(
&
in
,
0
,
do_tal_realloc
)
&&
errno
)
in
.
buf
=
tal_free
(
in
.
buf
);
rbuf_init
(
&
in
,
p
[
0
],
tal_arr
(
ctx
,
char
,
4096
),
4096
,
membuf_tal_realloc
);
ret
=
rbuf_read_str
(
&
in
,
'\0'
);
if
(
!
ret
)
tal_free
(
rbuf_cleanup
(
&
in
));
/* This shouldn't fail... */
if
(
waitpid
(
pid
,
&
status
,
0
)
!=
pid
)
...
...
@@ -97,14 +99,14 @@ char *run_with_timeout(const void *ctx, const char *cmd,
*
timeout_ms
-=
ms
;
close
(
p
[
0
]);
if
(
tools_verbose
)
{
printf
(
"%s"
,
in
.
buf
);
printf
(
"%s"
,
ret
);
printf
(
"Finished: %u ms, %s %u
\n
"
,
ms
,
WIFEXITED
(
status
)
?
"exit status"
:
"killed by signal"
,
WIFEXITED
(
status
)
?
WEXITSTATUS
(
status
)
:
WTERMSIG
(
status
));
}
*
ok
=
(
WIFEXITED
(
status
)
&&
WEXITSTATUS
(
status
)
==
0
);
return
in
.
buf
;
return
ret
;
}
/* Tals *output off ctx; return false if command fails. */
...
...
@@ -267,7 +269,7 @@ free:
return
ret
;
}
void
*
do_tal_realloc
(
void
*
p
,
size_t
size
)
void
*
membuf_tal_realloc
(
struct
membuf
*
mb
,
void
*
p
,
size_t
size
)
{
tal_resize
((
char
**
)
&
p
,
size
);
return
p
;
...
...
tools/tools.h
View file @
d98e77e5
...
...
@@ -67,7 +67,7 @@ const char *temp_dir(void);
void
keep_temp_dir
(
void
);
bool
move_file
(
const
char
*
oldname
,
const
char
*
newname
);
void
*
do_tal_realloc
(
void
*
p
,
size_t
size
);
void
*
membuf_tal_realloc
(
struct
membuf
*
mb
,
void
*
p
,
size_t
size
);
/* Freed on exit: a good parent for auto cleanup. */
tal_t
*
autofree
(
void
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment