You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

53 lines
1.6 KiB

  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