Nmap Development mailing list archives
Re: Problem with errno under VS2013
From: Daniel Miller <bonsaiviking () gmail com>
Date: Tue, 25 Nov 2014 08:23:14 -0600
On Tue, Nov 25, 2014 at 6:17 AM, Gisle Vanem <gvanem () yahoo no> wrote:
Daniel Miller wrote: When debugging, the pseudo-register @err,hr shows ERROR_FILE_NOT_FOUNDwith a value of 2, which corresponds directly to the ENOENT error we are trying to check for. I just don't understand why it's not being set in errno.When just preprocessing with MSVC v16 (VS2010 on Win-XP), I see this: static int rename_file(const char *from_filename, const char *to_filename) { int rc; (*_errno()) = 0; rc = unlink(to_filename); if (rc == -1 && (*_errno()) != 2) return -1; return rename(from_filename, to_filename); }
I saw the exact same thing. I know that errno is not being set because I saved its value in another variable and printed it out. However, I discovered that it works fine if I use _unlink instead of unlink. MS says not to use "deprecated" POSIX names, but VS didn't warn me at all. I'll look into the best way to accomplish this, but at least it works now. Dan
_______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Problem with errno under VS2013 Daniel Miller (Nov 24)
- Re: Problem with errno under VS2013 Gisle Vanem (Nov 25)
- Re: Problem with errno under VS2013 Daniel Miller (Nov 25)
- Re: Problem with errno under VS2013 Gisle Vanem (Nov 25)