FreeBSD Bugzilla – Attachment 119503 Details for
Bug 162050
[patch] misc/lv directory opening problem fix
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
lv.patch
lv.patch (text/plain), 1.32 KB, created by
Iwao Koichiro
on 2011-10-27 09:10:09 UTC
(
hide
)
Description:
lv.patch
Filename:
MIME Type:
Creator:
Iwao Koichiro
Created:
2011-10-27 09:10:09 UTC
Size:
1.32 KB
patch
obsolete
>diff -ruN --exclude='*~' /tmp/lv451/src/lv.c src/lv.c >--- /tmp/lv451/src/lv.c 2004-01-05 16:30:15.000000000 +0900 >+++ src/lv.c 2011-05-27 02:21:37.000000000 +0900 >@@ -2,6 +2,7 @@ > * lv.c > * > * All rights reserved. Copyright (C) 1996 by NARITA Tomio. >+ * Copyright (C) Oct 27, 2011 Koichiro IWAO. All rights reserved. > * $Id: lv.c,v 1.10 2004/01/05 07:30:15 nrt Exp $ > */ > /* >@@ -89,16 +90,35 @@ > grep_mode = FALSE; > } > >+private boolean_t isDirectory(byte **file) { >+ struct stat buf; >+ stat((unsigned char *)file, &buf); >+ if (S_ISDIR(buf.st_mode)) { >+ fprintf(stderr, "%s is a directory\n", file); >+ return TRUE; >+ } else { >+ return FALSE; >+ } >+} >+ > private boolean_t LvOpen( conf_t *conf ) > { >+ boolean_t flagIsDirectory = FALSE; >+ > if( NULL != conf->file ){ >+ if( TRUE == isDirectory( *conf->file ) ){ >+ flagIsDirectory = TRUE; >+ } > if( NULL == (conf->st = StreamOpen( *conf->file )) ){ > while( NULL != *(++conf->file) ){ >- if( NULL != (conf->st = StreamOpen( *conf->file )) ) >- return TRUE; >+ if( NULL != (conf->st = StreamOpen( *conf->file )) ){ >+ if( TRUE == isDirectory( *conf->file ) ){ >+ flagIsDirectory = TRUE; >+ } >+ } > } >- return FALSE; > } >+ return (TRUE == flagIsDirectory ? FALSE : TRUE); > } else { > conf->st = StreamReconnectStdin(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 162050
: 119503