From owner-freebsd-hackers Mon Nov 27 00:38:42 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id AAA14572 for hackers-outgoing; Mon, 27 Nov 1995 00:38:42 -0800 Received: from irz301.inf.tu-dresden.de (irz301.inf.tu-dresden.de [141.76.1.11]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id AAA14480 for ; Mon, 27 Nov 1995 00:38:07 -0800 Received: from sax.sax.de by irz301.inf.tu-dresden.de (8.6.12/8.6.12-s1) with ESMTP id JAA07365; Mon, 27 Nov 1995 09:36:06 +0100 Received: by sax.sax.de (8.6.11/8.6.12-s1) with UUCP id JAA03695; Mon, 27 Nov 1995 09:36:22 +0100 Received: (from j@localhost) by uriah.heep.sax.de (8.6.12/8.6.9) id JAA03924; Mon, 27 Nov 1995 09:22:06 +0100 From: J Wunsch Message-Id: <199511270822.JAA03924@uriah.heep.sax.de> Subject: Re: How can I remove hard links between directories? To: freebsd-hackers@freebsd.org (FreeBSD hackers) Date: Mon, 27 Nov 1995 09:22:05 +0100 (MET) Cc: bob@luke.pmr.com Reply-To: joerg_wunsch@uriah.heep.sax.de (Joerg Wunsch) In-Reply-To: <199511270213.VAA23308@skynet.ctr.columbia.edu> from "A boy and his worm gear" at Nov 26, 95 09:13:25 pm X-Phone: +49-351-2012 669 X-Mailer: ELM [version 2.4 PL23] MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Length: 3870 Sender: owner-hackers@freebsd.org Precedence: bulk As A boy and his worm gear wrote: > > > Help! An apparently buggy version of afio that I was running has > > created some hard links between a couple of directories on my system David? Didn't we nuke the ability to hard-link directories some day in 1.1.5.1? Should we nuke this again? > > (2.1-STABLE) and I need to get rid of them. Unfortunately rmdir > > simply complains that the directory is not empty (use counts on > > these two directries is 4 rather than 2). Can someone please tell > > me a way to fix this? > I can think of one admittedly ugly way to fix this: use clri to zap > the inode associated with this troublesome directory, then run fsck > to pick up the pieces afterwards. It's rather ugly. Better, use this: #include #include int main(int argc, char **argv) { int status = 0; if(argc < 2) { fprintf(stderr, "usage: unlink name [...]\n"); return 1; } while( ++argv, --argc) { if(unlink(*argv) == -1) { perror("unlink()"); status++; } } return status? 1: 0; } This used to be availabe as /etc/unlink in ancient systems. In case you've botched your system to a degree where you cannot run your C compiler, here's a binary for it: begin 755 unlink.gz M'XL("(9TN3```W5N;&EN:P#M5GUL$V48?Z_MH(RQ+RP,6.1`5!9Q8R88G!D. M9D64P=:NJ#%XE/6V]NS:IKT;^,'L1TU-T!A#C$3\3Q/_,''$10N;@DK\ M0&(,SF1!C(>Z>DVX!_=-_[DG>>][GZ_<^[_-^W0FVMX^5,V8T MHJ:"OG?+^@V;O8*_?;VO/=`J;-[:O'ZS]ZJ9!=(_J>==V_P9Q95YS)79YE9[ M74PNSFH.]:AK(*?\<=?\74[UZ%3:,[&,,?5N)B_3G&\>XAGK6\MD3[9O;9TR M)W,_EYZ'NB90*N>/>:<8")IW:B`G%^GG8)@P#SGIWY0!Q`C`RF7A.T$A,7W0 M4+D/(GJK7YO5JO<604]_%?19H#HEE:R+1G:*N\6.NFBH-A5GS7$E&HK=*O/Q MA!CC66TQNR\8B2I)D4^*P5`DUL4;?L5L0S#$=P>[(AT-EJ8Y&(O%95`F3`V_ M4A9WRS77,H2"]9=:1%J*^BX%?21&73,.Y8'*GL_,(1!C,FK#^,D/\!/_^0) M^,HK9R(O/,Q;+N-SLX=Q8QJ"OTUB1M(.J4@+Y'Q0GH]!K?N=6)Q1=60%%J=: MJ@K76OFLM?*I,_,I>]\[U&CD4=-H#+Y\YN`5TQ0GF")H+;F"_)NNFW7FI:60 MZ?C-V>F4>2D/.W&\M$!>"G,_PR[F\_6?CJ^#F9@9W9+^VLSIIIG0E>H1?GR> M%?\"%B3]17T^?2G]9YN/:E(I.;7`""SJJ!-*8Q:FP8&3_J$=%N27'$%^PM'" MZ\8)-@Y].@`G^N*QX5I,P%I\6E`?_P=CN&2- M8\:LX*1I3G48"@J/C3*A;9^:M@#HKWG.8L!D7EE*RJ_A'.9X&^0X8P"COH.(J)0=*\(.SE(? ML%85'APVG[%5/<"ATJMZ@2\"OA`OP5X*7`7P<^#_AYWGBB]W'& MDC#FAK806@6-"X\>@VR8DV3LXS,.F,;;XJ"86=#F$@8C6PGI2JD_CYJ%74:V MQ=2O).P;J#^?FH=T"ZB_B/I5E"NC/B/;$L)DU+?(R(V_FE\1)+_:8\HXWFPH MP@C95Y`]0?;;H7$@/T?V-62_2/9U)./Z(;51K4;)?P?)9TF.6_'D_RR-?XCL M+Y+=^F?:3^/O(_L!D@^0_!;)^TE^A_#>(_G#@CJX<9[,7-OGJ$"?4WYXL2*= M(KPHQ8^2_3+9?R2[3/9SE&\[S><"R6]0?7YG9OU/D?\5BG^:Y`K.Q)\B_`6< M&=]*"RP(]SZR97W+IF8FA*+X@P4:<7=$%D)*=_<30DCLB**E(QI/B4SH$F4Q MUH,*,9F,)\%7",6%KFA\9S`JA.1X,H6J>]NW^H3-F_SM@H!B\W3Q:D"'%9!( MQKOP:F(I.9B4F9`@],Y$,A*3.YE@WE734TN*G1B;NH\)(O[5`8OU1))QF$%0 M1C]0)).Q.!-,H3L8B6'FJ2>Z086_>Q!N#*@DA)0H1^,=0;AV`26$N(8[_/7" M.A[A\#PZC'IU,)MLLLFF_X?PGZ"<9VPE_]^^"7J#=H!O"%H"[OQWH67I4<=W MHQ4>=!Y_4N`];$(E^&7/3<+O#W#]$O%?@'/`SP!W`#\-W`G\)'`7\,^`%P$_ H"GP6^VY&;B,S9)MLLLDFFVRRR2:;;++))IMLLNG?Z6_T.MT"`"```,^` ` end -- cheers, J"org joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-)