diff options
author | Andrew Tridgell <tridge@samba.org> | 2010-03-05 22:58:18 +1100 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2010-03-05 23:07:32 +1100 |
commit | 568f0851f0fceca1511b689040340e19ef1b538b (patch) | |
tree | 5f9f9d936d3d0bc6002e8148d095f46bfa8f8e03 /source4/ntvfs/posix | |
parent | 2c2156ea9539a818625b0914aa2e1596571f428f (diff) | |
download | samba-568f0851f0fceca1511b689040340e19ef1b538b.tar.gz samba-568f0851f0fceca1511b689040340e19ef1b538b.tar.bz2 samba-568f0851f0fceca1511b689040340e19ef1b538b.zip |
s4-pvfs_sys: talloc_free should be before errno restore
talloc can potentially change the errno
Diffstat (limited to 'source4/ntvfs/posix')
-rw-r--r-- | source4/ntvfs/posix/pvfs_sys.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/source4/ntvfs/posix/pvfs_sys.c b/source4/ntvfs/posix/pvfs_sys.c index 5265e25007..178530775f 100644 --- a/source4/ntvfs/posix/pvfs_sys.c +++ b/source4/ntvfs/posix/pvfs_sys.c @@ -373,13 +373,13 @@ int pvfs_sys_unlink(struct pvfs_state *pvfs, const char *filename) ret = unlink(filename); if (ret == -1) { - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } - errno = orig_errno; talloc_free(ctx); + errno = orig_errno; return ret; } @@ -424,23 +424,23 @@ int pvfs_sys_rename(struct pvfs_state *pvfs, const char *name1, const char *name if (name2[0] != '/') { name2 = talloc_asprintf(ctx, "%s/%s", ctx->old_wd, name2); if (name2 == NULL) { - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } } /* make sure the destination isn't a symlink beforehand */ if (contains_symlink(name2)) { - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } ret = rename(name1, name2); if (ret == -1) { - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } @@ -448,13 +448,13 @@ int pvfs_sys_rename(struct pvfs_state *pvfs, const char *name1, const char *name if (contains_symlink(name2)) { DEBUG(0,(__location__ ": Possible symlink attack in rename to '%s' - unlinking\n", name2)); unlink(name2); - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } - errno = orig_errno; talloc_free(ctx); + errno = orig_errno; return ret; } @@ -532,13 +532,13 @@ int pvfs_sys_rmdir(struct pvfs_state *pvfs, const char *dirname) ret = rmdir(dirname); if (ret == -1) { - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } - errno = orig_errno; talloc_free(ctx); + errno = orig_errno; return ret; } @@ -570,13 +570,13 @@ int pvfs_sys_fchmod(struct pvfs_state *pvfs, int fd, mode_t mode) ret = fchmod(fd, mode); if (ret == -1) { - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } - errno = orig_errno; talloc_free(ctx); + errno = orig_errno; return ret; } @@ -609,12 +609,12 @@ int pvfs_sys_chmod(struct pvfs_state *pvfs, const char *filename, mode_t mode) ret = chmod(filename, mode); if (ret == -1) { - errno = saved_errno; talloc_free(ctx); + errno = saved_errno; return -1; } - errno = orig_errno; talloc_free(ctx); + errno = orig_errno; return ret; } |