]> saetta.ns0.it Git - libzakcgi/commitdiff
Conflict in merge from develop.
authorAndrea Zagli <azagli@libero.it>
Wed, 4 May 2016 13:18:40 +0000 (15:18 +0200)
committerAndrea Zagli <azagli@libero.it>
Wed, 4 May 2016 13:18:40 +0000 (15:18 +0200)
1  2 
src/session.c

diff --cc src/session.c
index 61d0462b6386e6dc630bdf11fc381936d7e3049e,d2e940a253a8f6d941f68116120ee4e5957aad83..0b74687a423adb260c086a5a6c09d19d6c392b87
@@@ -300,49 -301,10 +300,49 @@@ zak_cgi_session_set_value_full (ZakCgiS
  {
        ZakCgiSessionPrivate *priv = ZAK_CGI_SESSION_GET_PRIVATE (session);
  
 +      GError *error;
 +
        if (priv->kfile != NULL)
                {
 -                      g_key_file_set_string (priv->kfile, "SESSION", name, value);
 -                      g_key_file_save_to_file (priv->kfile, g_file_get_path (priv->gfile), NULL);
 +                      if (name == NULL)
 +                              {
 +                                      error = NULL;
 +                                      if (!g_key_file_remove_group (priv->kfile, group, &error)
 +                                              || error != NULL)
 +                                              {
 +                                                      g_warning ("Unable to unset key «%s» in group «%s»: %s.",
 +                                                                         name,
 +                                                                         group,
 +                                                                         error != NULL && error->message != NULL ? error->message : "no details");
 +                                              }
 +                              }
 +                      else
 +                              {
 +                                      if (value == NULL)
 +                                              {
 +                                                      error = NULL;
 +                                                      if (!g_key_file_remove_key (priv->kfile, group, name, &error)
 +                                                              || error != NULL)
 +                                                              {
 +                                                                      g_warning ("Unable to unset key «%s» in group «%s»: %s.",
 +                                                                                         name,
 +                                                                                         group,
 +                                                                                         error != NULL && error->message != NULL ? error->message : "no details");
 +                                                              }
 +                                              }
 +                                      else
 +                                              {
-                                                       g_key_file_set_value (priv->kfile, group, name, value);
++                                                      g_key_file_set_string (priv->kfile, group, name, value);
 +                                              }
 +                              }
 +
 +                      error = NULL;
 +                      if (!g_key_file_save_to_file (priv->kfile, g_file_get_path (priv->gfile), &error)
 +                              || error != NULL)
 +                              {
 +                                      g_warning ("Unable to write session file: %s.",
 +                                                         error != NULL && error->message != NULL ? error->message : "no details");
 +                              }
                }
  }