Listing 2: Symbolic link cases
163 if ( -l $rfile ) # file is a symbolic link
164 {
165 $to = readlink($rfile);
166 if ($to)
167 {
168 # if ( -e $to ) # target exists
169 # {
170 unless (symlink($to,$lfile))
171 {
172 $msg .=
173 "\tWARNING: symlink failed, $!; ".
174 "$lfile -> $to\n";
175 }
176 else
177 {
178 utime($r_atime,$r_mtime,$lfile);
179 $msg .= "\tcreated symbolic link $lfile -> $to\n";
180 }
181 # }
182 # else
183 # {
184 # $msg .= "\tWARNING: $rfile points to nonexistant file "
185 # . "$to\n";
186 # }
187 }
188 else
189 {
190 $msg .= "\tWARNING: null symlink from $rfile\n";
191 }
192 }
|