git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Fix v1] builtin/ls-files.c: add error check on lstat for modified files
@ 2019-02-17 16:34 randall.s.becker
  2019-02-17 17:04 ` Ramsay Jones
  2019-04-01  9:29 ` Junio C Hamano
  0 siblings, 2 replies; 4+ messages in thread
From: randall.s.becker @ 2019-02-17 16:34 UTC (permalink / raw)
  To: git; +Cc: Randall S. Becker

From: "Randall S. Becker" <rsbecker@nexbridge.com>

The result from lstat, checking whether a file has been deleted, is now
included priot to calling id_modified when showing modified files. Prior
to this fix, it is possible that files that were deleted could show up
as being modified because the lstat error was unchecked.

Reported-by: Joe Ranieri <jranieri@grammatech.com>
Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
---
 builtin/ls-files.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/ls-files.c b/builtin/ls-files.c
index 29a8762d4..fc21f4795 100644
--- a/builtin/ls-files.c
+++ b/builtin/ls-files.c
@@ -348,7 +348,7 @@ static void show_files(struct repository *repo, struct dir_struct *dir)
 			err = lstat(fullname.buf, &st);
 			if (show_deleted && err)
 				show_ce(repo, dir, ce, fullname.buf, tag_removed);
-			if (show_modified && ie_modified(repo->index, ce, &st, 0))
+			if (show_modified && !err && ie_modified(repo->index, ce, &st, 0))
 				show_ce(repo, dir, ce, fullname.buf, tag_modified);
 		}
 	}
-- 
2.12.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-04-01  9:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-17 16:34 [Fix v1] builtin/ls-files.c: add error check on lstat for modified files randall.s.becker
2019-02-17 17:04 ` Ramsay Jones
2019-02-17 17:29   ` Randall S. Becker
2019-04-01  9:29 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).