*ptr = '\0';
}
+static inline int posix_close(int fd) {
+ if (close(fd) == 0)
+ return 0;
+ perror("close");
+ if (errno != EINTR)
+ return -1;
+ if (close(fd) < 0) {
+ perror("close");
+ return -1;
+ }
+ return 0;
+}
+
static inline int perftrace_collect_details(pid_t pid, struct pid_item *item) {
struct timespec utime;
unsigned long ppid = 0;
fprintf(stderr, "Error: missing state (%s)\n", buffer);
}
error:
- close(fd);
+ posix_close(fd);
return ret;
}