Fixed a bug where do_readdirplus would occasionally fail to write, and then try to...
authorRaymond Barbiero <raymond.barbiero.dev@gmail.com>
Sun, 12 Aug 2012 04:50:15 +0000 (21:50 -0700)
committerRonnie Sahlberg <ronniesahlberg@gmail.com>
Sun, 12 Aug 2012 05:24:18 +0000 (15:24 +1000)
Background:
  COOKIE3 was an undefined variable. Pass COOKIE to do_readdirplus.
  To prevent STATUS being interpreted as $4 when COOKIE is empty, quote all parameters passed.

web/nfsloadfile.sh

index 3ebc3498a74635b3ec487473abd0b8276bfe66ed..f8891a75db86b37b517ad4e17cc43fd47c8d1e86 100755 (executable)
@@ -15,14 +15,12 @@ extract_quoted_field() {
 
 do_readdirplus() {
        if [ $2 != "1" ]; then
-               if [ $4 != "0" ]; then
-                       echo $TIMESTAMP READDIRPLUS3 \"$3\" >$DBDIR/$1
-               fi
+               echo $TIMESTAMP READDIRPLUS3 \"$3\" $4 >$DBDIR/$1
        else
                CMD=`cat $DBDIR/$1`
                # we only generate the operation if we saw the request
                if [ "${CMD}x" != "x" ]; then
-                       echo $CMD $4
+                       echo $CMD $5
                fi
        fi
 }
@@ -128,7 +126,7 @@ case "$PACKET" in
                STATUS=`extract_field "$PACKET" "nfs.nfsstat3" | awk '{ printf "0x%08x", $1 }'`
                FULLNAME=`extract_quoted_field "$PACKET" "nfs.full_name"`
                COOKIE=`extract_field "$PACKET" "nfs.cookie3"`
-               do_readdirplus $XID $MSGTYP "$FULLNAME" $COOKIE3 $STATUS
+               do_readdirplus "$XID" "$MSGTYP" "$FULLNAME" "$COOKIE" "$STATUS"
                
                ;;
        # READ