0002-Use-the-current-directory-for-storing-and-loading-se.patch (1672B)
1 From cd444949f3176790101b8bdc9656831a03d8c01d Mon Sep 17 00:00:00 2001 2 From: Paul Fertser <fercerpav@gmail.com> 3 Date: Tue, 10 Jul 2012 11:13:29 +0400 4 Subject: [PATCH 2/3] Use the current directory for storing and loading 5 sessions 6 7 This allows the user to always explicitely choose (by changing the 8 current directory before launching the program) where the session 9 files should go. Useful e.g. to avoid hogging the precious space on 10 embedded devices, just cd /tmp before starting the app. 11 12 Signed-off-by: Paul Fertser <fercerpav@gmail.com> 13 --- 14 src/session.c | 16 +++------------- 15 1 files changed, 3 insertions(+), 13 deletions(-) 16 17 diff --git a/src/session.c b/src/session.c 18 index d3af0c3..308f213 100644 19 --- a/src/session.c 20 +++ b/src/session.c 21 @@ -62,7 +62,7 @@ int restore_session() 22 memset(file, 0, FILENAME_MAX); 23 24 bssid = mac2str(get_bssid(), '\0'); 25 - snprintf(file, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT); 26 + snprintf(file, FILENAME_MAX, "%s.%s", bssid, CONF_EXT); 27 free(bssid); 28 } 29 30 @@ -199,18 +199,8 @@ int save_session() 31 } 32 else 33 { 34 - /* 35 - * If the configuration directory exists, save the session file there; else, save it to the 36 - * current working directory. 37 - */ 38 - if(configuration_directory_exists()) 39 - { 40 - snprintf((char *) &file_name, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT); 41 - } 42 - else 43 - { 44 - snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT); 45 - } 46 + /* save session to the current directory */ 47 + snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT); 48 } 49 50 /* Don't bother saving anything if nothing has been done */ 51 -- 52 1.7.7 53