[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] Checking permissions before opening file
From: |
Mike Frysinger |
Subject: |
Re: [Nano-devel] Checking permissions before opening file |
Date: |
Tue, 26 Jan 2016 15:43:27 -0500 |
On 26 Jan 2016 14:00, Rishabh Dave wrote:
> Well, I don't know much about issues of security, portability or while
> running as superuser, but symbolic links won't give a problem as we check
> for that before using access() -
>
> + } else if (!S_ISDIR(parentinfo.st_mode)) {
> + statusbar(_("Path '%s' is not a directory"), parentdir);
> + beep();
> + } else {
> + if (access(parentdir, X_OK) != -1)
err, no, that code isn't doing what you think it does. stat()
dereferences symlinks. you need to use lstat() to operate on
the symlink itself.
-mike
signature.asc
Description: Digital signature