Index: upower-0.9.1/src/up-daemon.c =================================================================== --- upower-0.9.1.orig/src/up-daemon.c 2010-03-29 21:17:06.000000000 +0200 +++ upower-0.9.1/src/up-daemon.c 2010-03-29 21:21:10.000000000 +0200 @@ -154,9 +154,11 @@ gchar *contents_crypttab = NULL; gchar **lines_swaps = NULL; gchar **lines_crypttab = NULL; + gchar **split_crypttab = NULL; GError *error = NULL; gboolean ret; gboolean encrypted_swap = FALSE; + gboolean safe_encrypted_swap = FALSE; const gchar *filename_swaps = "/proc/swaps"; const gchar *filename_crypttab = "/etc/crypttab"; GPtrArray *devices = NULL; @@ -216,18 +218,33 @@ lines_crypttab[i][0] == '\0') continue; - /* only look at first parameter */ - g_strdelimit (lines_crypttab[i], "\t ", '\0'); - - /* is a swap device? */ - for (j=0; jlen; j++) { - device = g_ptr_array_index (devices, j); - if (g_strcmp0 (device, lines_crypttab[i]) == 0) { - egg_debug ("swap device %s is encrypted (so cannot hibernate)", device); - encrypted_swap = TRUE; - goto out; + /* split the line */ + split_crypttab = g_strsplit (lines_crypttab[i], "\t", 4); + safe_encrypted_swap = FALSE; + if (g_strv_length (split_crypttab) >= 4) { + /* this is a hack. Can we add a "can_hibernate" option to crypttab without breaking things */ + if (g_strrstr( split_crypttab[3], "decrypt_derived") != NULL) { + safe_encrypted_swap = TRUE; + } + } + /* free the split string */ + g_strfreev(split_crypttab); + split_crypttab = NULL; + + if (!safe_encrypted_swap) { + /* continue with only the first parameter */ + g_strdelimit (lines_crypttab[i], "\t ", '\0'); + + /* is a swap device? */ + for (j=0; jlen; j++) { + device = g_ptr_array_index (devices, j); + if (g_strcmp0 (device, lines_crypttab[0]) == 0) { + egg_debug ("swap device %s is encrypted (so cannot hibernate)", device); + encrypted_swap = TRUE; + goto out; + } + egg_debug ("swap device %s is not encrypted (allows hibernate)", device); } - egg_debug ("swap device %s is not encrypted (allows hibernate)", device); } }