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
d92d6ae7
Commit
d92d6ae7
authored
Nov 14, 2008
by
Rusty Russell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix new glibc warnings about warn_unused_result.
parent
49b125f3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
98 additions
and
4 deletions
+98
-4
ccan/antithread/antithread.c
ccan/antithread/antithread.c
+2
-1
ccan/read_write_all/_info.c
ccan/read_write_all/_info.c
+43
-0
ccan/read_write_all/read_write_all.c
ccan/read_write_all/read_write_all.c
+38
-0
ccan/read_write_all/read_write_all.h
ccan/read_write_all/read_write_all.h
+9
-0
ccan/tap/tap.c
ccan/tap/tap.c
+6
-3
No files found.
ccan/antithread/antithread.c
View file @
d92d6ae7
...
...
@@ -11,6 +11,7 @@
#include "antithread.h"
#include <ccan/noerr/noerr.h>
#include <ccan/talloc/talloc.h>
#include <ccan/read_write_all/read_write_all.h>
#include <ccan/alloc/alloc.h>
/* FIXME: Valgrind support should be possible for some cases. Tricky
...
...
@@ -290,7 +291,7 @@ struct athread *at_spawn(struct at_pool *pool, void *arg, char *cmdline[])
execvp
(
argv
[
0
],
argv
);
err
=
errno
;
write
(
pool
->
parent_wfd
,
&
err
,
sizeof
(
err
));
write
_all
(
pool
->
parent_wfd
,
&
err
,
sizeof
(
err
));
exit
(
1
);
}
...
...
ccan/read_write_all/_info.c
0 → 100644
View file @
d92d6ae7
#include <stdio.h>
#include <string.h>
#include "config.h"
/**
* read_write_all - read_all and write_all routines.
*
* Successful read and write calls may only partly complete if a
* signal is received or they are not operating on a normal file.
*
* read_all() and write_all() do the looping for you.
*
* Example:
* #include <err.h>
* #include <stdio.h>
* #include <unistd.h>
* #include <ccan/read_write_all/read_write_all.h>
*
* #define BUFFER_SIZE 10
* int main(int argc, char *argv[])
* {
* char buffer[BUFFER_SIZE+1];
*
* if (!read_all(STDIN_FILENO, buffer, BUFFER_SIZE))
* err(1, "Could not read %u characters", BUFFER_SIZE);
* buffer[BUFFER_SIZE] = '\0';
* printf("I read '%.*s'\n", BUFFER_SIZE, buffer);
* return 0;
* }
*
* Licence: LGPL (2 or any later version)
*/
int
main
(
int
argc
,
char
*
argv
[])
{
if
(
argc
!=
2
)
return
1
;
if
(
strcmp
(
argv
[
1
],
"depends"
)
==
0
)
{
return
0
;
}
return
1
;
}
ccan/read_write_all/read_write_all.c
0 → 100644
View file @
d92d6ae7
#include "read_write_all.h"
#include <unistd.h>
#include <errno.h>
bool
write_all
(
int
fd
,
const
void
*
data
,
size_t
size
)
{
while
(
size
)
{
ssize_t
done
;
done
=
write
(
fd
,
data
,
size
);
if
(
done
<
0
&&
errno
==
EINTR
)
continue
;
if
(
done
<=
0
)
return
false
;
data
+=
done
;
size
-=
done
;
}
return
true
;
}
bool
read_all
(
int
fd
,
void
*
data
,
size_t
size
)
{
while
(
size
)
{
ssize_t
done
;
done
=
read
(
fd
,
data
,
size
);
if
(
done
<
0
&&
errno
==
EINTR
)
continue
;
if
(
done
<=
0
)
return
false
;
data
+=
done
;
size
-=
done
;
}
return
true
;
}
ccan/read_write_all/read_write_all.h
0 → 100644
View file @
d92d6ae7
#ifndef _CCAN_READ_WRITE_H
#define _CCAN_READ_WRITE_H
#include <stddef.h>
#include <stdbool.h>
bool
write_all
(
int
fd
,
const
void
*
data
,
size_t
size
);
bool
read_all
(
int
fd
,
void
*
data
,
size_t
size
);
#endif
/* _CCAN_READ_WRITE_H */
ccan/tap/tap.c
View file @
d92d6ae7
...
...
@@ -105,7 +105,8 @@ _gen_result(int ok, const char *func, char *file, unsigned int line,
expansions on it */
if
(
test_name
!=
NULL
)
{
va_start
(
ap
,
test_name
);
vasprintf
(
&
local_test_name
,
test_name
,
ap
);
if
(
vasprintf
(
&
local_test_name
,
test_name
,
ap
)
<
0
)
local_test_name
=
NULL
;
va_end
(
ap
);
/* Make sure the test name contains more than digits
...
...
@@ -363,7 +364,8 @@ skip(unsigned int n, char *fmt, ...)
LOCK
;
va_start
(
ap
,
fmt
);
vasprintf
(
&
skip_msg
,
fmt
,
ap
);
if
(
vasprintf
(
&
skip_msg
,
fmt
,
ap
)
<
0
)
skip_msg
=
NULL
;
va_end
(
ap
);
while
(
n
--
>
0
)
{
...
...
@@ -386,7 +388,8 @@ todo_start(char *fmt, ...)
LOCK
;
va_start
(
ap
,
fmt
);
vasprintf
(
&
todo_msg
,
fmt
,
ap
);
if
(
vasprintf
(
&
todo_msg
,
fmt
,
ap
)
<
0
)
todo_msg
=
NULL
;
va_end
(
ap
);
todo
=
1
;
...
...
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