From 14449e4e00200235b921b42f126138b33c2afe4c Mon Sep 17 00:00:00 2001 From: "cantab.net!aia21" Date: Fri, 23 Apr 2004 10:54:57 +0000 Subject: [PATCH] - Fix silly bug where j is used to store the error code but i is later expected to be storing it. (Yuval) - Fix some warnings. (Yuval, me) (Logical change 1.380) --- libntfs/security.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libntfs/security.c b/libntfs/security.c index 1db2ebd8..78fcae99 100644 --- a/libntfs/security.c +++ b/libntfs/security.c @@ -178,8 +178,7 @@ char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size) { u64 u; char *s; - size_t cnt; - int i, j; + int i, j, cnt; /* * No need to check @sid if !@sid_str since ntfs_sid_to_mbs_size() will @@ -222,13 +221,13 @@ char *ntfs_sid_to_mbs(const SID *sid, char *sid_str, size_t sid_str_size) s += i; cnt -= i; /* Finally, add the sub authorities. */ - for (i = 0; i < sid->sub_authority_count; i++) { - j = snprintf(s, cnt, "-%u", (unsigned int) - le32_to_cpu(sid->sub_authority[i])); - if (j < 0 || j >= cnt) + for (j = 0; j < sid->sub_authority_count; j++) { + i = snprintf(s, cnt, "-%u", (unsigned int) + le32_to_cpu(sid->sub_authority[j])); + if (i < 0 || i >= cnt) goto err_out; - s += j; - cnt -= j; + s += i; + cnt -= i; } return sid_str; err_out: