We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c4d757b commit cb1f71bCopy full SHA for cb1f71b
instruments/base/base.c
@@ -36,8 +36,10 @@ static char logfile[] = "/data/local/tmp/adbi.log";
36
static void logmsgtofile(char *msg)
37
{
38
int fp = open(logfile, O_WRONLY|O_APPEND);
39
- write(fp, msg, strlen(msg));
40
- close(fp);
+ if (fp != -1) {
+ write(fp, msg, strlen(msg));
41
+ close(fp);
42
+ }
43
}
44
45
static void logmsgtostdout(char *msg)
instruments/example/epoll.c
@@ -32,9 +32,9 @@
32
#undef log
33
34
#define log(...) \
35
- {FILE *fp = fopen("/data/local/tmp/adbi_example.log", "a+");\
+ {FILE *fp = fopen("/data/local/tmp/adbi_example.log", "a+"); if (fp) {\
fprintf(fp, __VA_ARGS__);\
- fclose(fp);}
+ fclose(fp);}}
// this file is going to be compiled into a thumb mode binary
0 commit comments