diff --git a/makefile b/makefile index 90e019fdaa1062dbfc15f97114d5d99100ed254b..1ff338f13b423740b21d8cca5e23e227071a7fd6 100644 --- a/makefile +++ b/makefile @@ -10,21 +10,21 @@ mojitos_group: $(OBJECTS_GRP) counters_option.h gcc $(DEBUG) -O3 -Wall -o mojitos_group $(OBJECTS_GRP) -lpowercap counters_%.o: counters_%.c counters.h - gcc -c -O3 -Wall $< -o $@ + gcc $(DEBUG) -c -O3 -Wall $< -o $@ counters_option.h: counters_option.py ./counters_option.py > counters_option.h mojitos.o: mojitos.c counters_option.h - gcc -c -O3 -Wall $< -o $@ + gcc $(DEBUG) -c -O3 -Wall $< -o $@ -debug: DEBUG = -DDEBUG +debug: DEBUG = -DDEBUG -g debug: all %.o : %.c %.h - gcc -c -O3 -Wall $< -o $@ + gcc $(DEBUG) -c -O3 -Wall $< -o $@ clean: \rm -f *~ *.o mojitos_group mojitos counters_option.h diff --git a/network.c b/network.c index 0c03cb5f99f3a67cf0a79fa002e6010316e5adc6..5bab8620a298b450d41bd5cc2bb188866fd2fc83 100644 --- a/network.c +++ b/network.c @@ -34,6 +34,7 @@ char **init_network(char* dev) { char *end_of_dev = index(buffer, '\t'); *end_of_dev='\0'; dev = buffer; + fclose(f); } char *filenames[] = {"/sys/class/net/%s/statistics/rx_packets",