#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: magic.c,v 1.81 2013/11/29 15:42:51 christos Exp $")
+FILE_RCSID("@(#)$File: magic.c,v 1.82 2014/05/13 16:38:23 christos Exp $")
#endif /* lint */
#include "magic.h"
private int
unreadable_info(struct magic_set *ms, mode_t md, const char *file)
{
- /* We cannot open it, but we were able to stat it. */
- if (access(file, W_OK) == 0)
- if (file_printf(ms, "writable, ") == -1)
- return -1;
- if (access(file, X_OK) == 0)
- if (file_printf(ms, "executable, ") == -1)
- return -1;
+ if (file) {
+ /* We cannot open it, but we were able to stat it. */
+ if (access(file, W_OK) == 0)
+ if (file_printf(ms, "writable, ") == -1)
+ return -1;
+ if (access(file, X_OK) == 0)
+ if (file_printf(ms, "executable, ") == -1)
+ return -1;
+ }
if (S_ISREG(md))
if (file_printf(ms, "regular file, ") == -1)
return -1;