Changeset 578

Show
Ignore:
Timestamp:
07/03/08 07:24:22 (3 months ago)
Author:
weyrick
Message:

need to double check dirs on GLOB_ONLYDIR

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pcc/runtime/ext/standard/php-files.scm

    r460 r578  
    13061306                (begin 
    13071307                   (dotimes (i (pragma::int "$1->gl_pathc" globbuf)) 
    1308                       (php-hash-insert! rethash 
    1309                                         :next 
    1310                                         ($string->bstring (pragma::string "$1->gl_pathv[$2]" 
     1308                     (let ((fname ($string->bstring (pragma::string "$1->gl_pathv[$2]" 
    13111309                                                                          globbuf 
    13121310                                                                          i)))) 
    1313                    (c-globfree globbuf))) 
     1311                        ; from man page: glob() doesn't actually guarantee only directories are 
     1312                        ; returned with GLOB_ONLYDIR so we have to check anyway if that's specified 
     1313                        (if (>fx (bit-and flags c-GLOB_ONLYDIR) 0) 
     1314                            ; dir check 
     1315                            (when (directory? fname) 
     1316                               (php-hash-insert! rethash 
     1317                                                 :next 
     1318                                                 fname)) 
     1319                            ; no dir check 
     1320                            (php-hash-insert! rethash 
     1321                                              :next 
     1322                                              fname)))))) 
     1323             ; leave gc'd? 
     1324             ;(c-globfree globbuf) 
    13141325             rethash) 
    13151326          ; glob error condition