~ecryptfs/ecryptfs/trunk

« back to all changes in this revision

Viewing changes to src/testcases/zombie.c

  • Committer: Dustin Kirkland
  • Date: 2009-02-13 15:57:24 UTC
  • Revision ID: kirkland@canonical.com-20090213155724-1q3qz2o0cbyimu9x
debian/ubuntu packaging

Initial checkin of the Debian/Ubuntu packaging

Signed-off-by: Dustin Kirkland <kirkland@canonical.com>

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <stdio.h>
 
2
#include <ecryptfs.h>
 
3
 
 
4
int main()
 
5
{
 
6
        int rc;
 
7
 
 
8
        if (fork() == 0) {
 
9
                printf("Setting placeholder\n");
 
10
                if ((rc = ecryptfs_set_zombie_session_placeholder())) {
 
11
                        printf("Error setting zombie placeholder; rc = [%d]\n", rc);
 
12
                        goto out;
 
13
                }
 
14
                exit(1);
 
15
        }
 
16
        sleep(5);
 
17
        printf("Listing placeholders\n");
 
18
        if ((rc = ecryptfs_list_zombie_session_placeholders())) {
 
19
                printf("Error listing zombie placeholders; rc = [%d]\n", rc);
 
20
                goto out;
 
21
        }
 
22
        sleep(1);
 
23
        printf("Killing and clearing placeholder\n");
 
24
        if ((rc = ecryptfs_kill_and_clear_zombie_session_placeholder())) {
 
25
                printf("Error killing and clearing zombie placeholder; "
 
26
                       "rc = [%d]\n", rc);
 
27
                goto out;
 
28
        }
 
29
        sleep(1);
 
30
        printf("Listing placeholder\n");
 
31
        if ((rc = ecryptfs_list_zombie_session_placeholders())) {
 
32
                printf("Error listing zombie placeholders; rc = [%d]\n", rc);
 
33
                goto out;
 
34
        }
 
35
out:
 
36
        return rc;
 
37
}