OSDN Git Service

android: Add simple rotation of snoop file
authorAndrzej Kaczmarek <andrzej.kaczmarek@tieto.com>
Wed, 15 Jan 2014 21:01:36 +0000 (22:01 +0100)
committerSzymon Janc <szymon.janc@tieto.com>
Thu, 16 Jan 2014 07:59:31 +0000 (08:59 +0100)
Already existing snoop file is renamed by adding ".old" suffix before
new one is created. This is useful in case phone is restarted so logs
are not overwritten and for this reason it's only applied in case
default snoop file name is used.

android/bluetoothd-snoop.c

index 2b0d426..9312c11 100644 (file)
@@ -206,6 +206,9 @@ int main(int argc, char *argv[])
 
        mainloop_set_signal(&mask, signal_callback, NULL, NULL);
 
+       if (!strcmp(DEFAULT_SNOOP_FILE, path))
+               rename(DEFAULT_SNOOP_FILE, DEFAULT_SNOOP_FILE ".old");
+
        if (open_monitor(path) < 0) {
                printf("Failed to start bluetoothd_snoop\n");
                return EXIT_FAILURE;