# Can't Declare Variables in Capsicum



## 2trill2spill (Jul 15, 2014)

I've been trying to *s*andbox my program with Capsicum, but I am unable to declare *v*ariables after I call `cap_enter()`. 


```
int initBlackBox()
{
    /* Declare Variables */
    int rtrn;

    /* SandBox BlackBox with Capscium. */
    rtrn = cap_enter();
    if(rtrn < 0)
    {
     return -1;
    }
    
    /* Display Starting Banner */
    startingBanner();
    
    /* Display Copywright and wait for user to read */
    displayCopywright();
    
    /* Check If Log File Exist. */
    rtrn = checkLog();
    if(rtrn < 0)
    {
        return -1;
    }
    ...

}
```

The Program Segfaults in checkLog(), At the Variable Declarartions.

```
int checkLog()
{
    
    /* Declarations. */
    int fd, rtrn;
    char *path, *p1, *p2;
    cap_rights_t rights;

   ...
}
```

So *h*ow *d*o I *d*eclare *v*ariables under Capsicum?


----------



## mjguzik (Jul 19, 2014)

There is not enough data to conclude anything.

cap_enter has no effect on the ability to declare variables. Of course it may be there is a weird bug which causes havoc, but this is highly unlikely.

I can only suggest you post entire source + compile with -O0 -g3 + post backtrace from the debugger when the program crashes.


----------

