Skip to content

Commit

Permalink
Merge pull request iovisor#1102 from palmtenor/fixwarning
Browse files Browse the repository at this point in the history
Fix compiler warning on redefined Macro
  • Loading branch information
4ast committed Apr 8, 2017
2 parents e2a0377 + 68a52b8 commit 08b8bd6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/cc/BPFTable.cc
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,14 @@ StatusTuple BPFPerfBuffer::close_all_cpu() {
std::string errors;
bool has_error = false;

int close_res = close(epfd_);
epfd_ = -1;
ep_events_.reset();
if (close_res != 0) {
has_error = true;
errors += std::string(std::strerror(errno)) + "\n";
if (epfd_ >= 0) {
int close_res = close(epfd_);
epfd_ = -1;
ep_events_.reset();
if (close_res != 0) {
has_error = true;
errors += std::string(std::strerror(errno)) + "\n";
}
}

std::vector<int> opened_cpus;
Expand Down
3 changes: 3 additions & 0 deletions src/cc/bcc_proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif

#include <sys/types.h>
#include <sys/stat.h>
#include <sys/mman.h>
Expand Down
2 changes: 1 addition & 1 deletion src/cc/perf_reader.c
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ void perf_reader_event_read(struct perf_reader *reader) {
if (reader->lost_cb) {
reader->lost_cb(lost);
} else {
fprintf(stderr, "Possibly lost " PRIu64 " samples\n", lost);
fprintf(stderr, "Possibly lost %" PRIu64 " samples\n", lost);
}
} else if (e->type == PERF_RECORD_SAMPLE) {
if (reader->type == PERF_TYPE_TRACEPOINT)
Expand Down

0 comments on commit 08b8bd6

Please sign in to comment.