0002-Use-the-current-directory-for-storing-and-loading-se.patch 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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. This allows the user to always explicitely choose (by changing the
  7. current directory before launching the program) where the session
  8. files should go. Useful e.g. to avoid hogging the precious space on
  9. embedded devices, just cd /tmp before starting the app.
  10. Signed-off-by: Paul Fertser <fercerpav@gmail.com>
  11. ---
  12. src/session.c | 16 +++-------------
  13. 1 files changed, 3 insertions(+), 13 deletions(-)
  14. diff --git a/src/session.c b/src/session.c
  15. index d3af0c3..308f213 100644
  16. --- a/src/session.c
  17. +++ b/src/session.c
  18. @@ -62,7 +62,7 @@ int restore_session()
  19. memset(file, 0, FILENAME_MAX);
  20. bssid = mac2str(get_bssid(), '\0');
  21. - snprintf(file, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT);
  22. + snprintf(file, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
  23. free(bssid);
  24. }
  25. @@ -199,18 +199,8 @@ int save_session()
  26. }
  27. else
  28. {
  29. - /*
  30. - * If the configuration directory exists, save the session file there; else, save it to the
  31. - * current working directory.
  32. - */
  33. - if(configuration_directory_exists())
  34. - {
  35. - snprintf((char *) &file_name, FILENAME_MAX, "%s/%s.%s", CONF_DIR, bssid, CONF_EXT);
  36. - }
  37. - else
  38. - {
  39. - snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
  40. - }
  41. + /* save session to the current directory */
  42. + snprintf((char *) &file_name, FILENAME_MAX, "%s.%s", bssid, CONF_EXT);
  43. }
  44. /* Don't bother saving anything if nothing has been done */
  45. --
  46. 1.7.7