summaryrefslogtreecommitdiffstats
path: root/sbin/restore/dirs.c
Commit message (Collapse)AuthorAgeFilesLines
* restore: promote some getfiles() parameters to size_t.pfg2016-05-011-8/+8
| | | | | | | | | | | | | | This is based on a change from OpenBSD: "Fix restore so that it can actually restore files larger than 4GB by changing the type of "size" to off_t in getfiles() plus little dependent type cleanup, from Daniel Lucq." It is an important for machines with 32 bit longs. While here unsign the flags, also from OpenBSD. Obtained from: OpenBSD (through bitrig, I hate CVS) MFC after: 2 weeks
* Use MIN()/MAX() macros from sys/param.h.araujo2016-04-211-1/+1
| | | | MFC after: 2 weeks.
* restore: use our roundup2/rounddown2() macros when param.h is available.pfg2016-04-191-1/+1
| | | | While here cleanup a little a malloc call.
* malloc will return NULL if it cannot allocate memory.araujo2016-04-191-1/+1
| | | | MFC after: 2 weeks.
* restore: Preserve timestamps to the nanosecond.jilles2015-03-141-8/+8
| | | | | | | | | The restore utility already knows the full-resolution timestamps, so the only thing to do is to stop converting the timespecs to timevals and use futimens() and utimensat(). Differential Revision: https://reviews.freebsd.org/D2020 Reviewed by: jhb
* Fix sbin/ build with a 64-bit ino_t.mdf2012-09-271-6/+8
| | | | Original code by: Gleb Kurtsou
* - Cast time_t, int64_t and some int32_t values to intmax_t and use "%jd"jh2010-01-291-8/+11
| | | | | | | | | | | | | in format strings. - Use (void) instead of (void *) when discarding strcat(3) return value. - Format string fixes to match variable types. - Change canon() len parameter and getcmd() size parameter type from int to size_t. - Style Makefile and increase WARNS to 2. PR: bin/140061 Submitted by: uqs Approved by: trasz (mentor)
* Fix nits pointed out in PR bin/39905 that have not already beenmckusick2008-05-231-3/+3
| | | | | | corrected since it was filed. With this change the PR will be closed. PR: bin/39905
* restore(8) does not check for write failure while building two tempmckusick2008-04-141-24/+68
| | | | | | | | | | | files containing directory and ownership data. If /tmp fills, the console is blasted with zillions of "file system full" errors, and restore continues on, even though directory and/or ownership data has been lost. This is particularly likely to happen when running from the live CD, which has little /tmp space. PR: bin/93603, also probably bin/107213 Fix from: Ken Lalonde
* Correctly set file group when restore is run by a user other than root.mckusick2008-04-111-1/+6
|
* Use safer string handling.imp2008-04-031-5/+4
| | | | Reviewed by: security-team
* Update the dump program to save extended attributes. Updatemckusick2007-02-261-12/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | the restore program to restore all dumped extended attributes. If the restore is running as root, it will always be able to restore all extended attributes. If it is not running as root, it makes a best effort to set them. Using the -v command line flag or the `verbose' command in interactive mode will display all the extended attributes being set on files (and at the end on directories) that are being restored. It will note any extended attributes that could not be set. The extended attributes are placed on the dump image immediately following each file's data. Older versions of restore can work with the newer dump images. Old versions of restore will correctly restore the file data and then (silently) skip over the extended attribute data and proceed to the next file. This resolves PR 93085 which will be closed once the code has been MFC'ed. Note that this code will not compile until these header files have been updated: <protocols/dumprestore.h> and <sys/extattr.h>. PR: bin/93085 Comments from: Poul-Henning Kamp and Robert Watson MFC after: 3 weeks
* Remove debug from last commitimp2005-04-031-2/+0
|
* Restore the ability to read FreeBSD 1 tapes (and I think any net2imp2005-03-251-0/+10
| | | | | | | | | | | | | | | based tapes, but I'm not sure where NFS_MAGIC was introduced after 4.3). When support for the pre-4.4 format was removed (the ability to read 4.2 and 4.3 BSD tapes), the old format inode conversion was junked as well. However, FreeBSD 1 dump tapes use the NFS_MAGIC format, but have this inode format. Before, restore would fail complaining that '.' wasn't found and the root directory wasn't on this tape. Since the conversion from the not so old format is relatively trivial, restore the code to make that conversion. FreeBSD 1 dumps are once again readable. MFC After: a few days
* dcvt is unused since the support for converting pre-4.4 tapes wasimp2005-03-251-25/+2
| | | | | | | removed. Go ahead and remove it and struct odirent since it too is unused. # FreeBSD 1.1.5 tapes are still unreadable, but 2.0 and newer work.
* Use the correct types for the functions rst_opendir(), glob_readdir() andstefanf2004-05-241-2/+4
| | | | | | | rst_closedir() which are called by glob(). Reviewed by: md5 Approved by: das (mentor)
* Remove advertising clause from University of California Regent's license,markm2004-04-091-4/+0
| | | | | | per letter dated July 22, 1999. Approved by: core, imp
* Fix gcc warnings. If NAME_MAX is 255, and d_namlen is a uint8_t, thenpeter2003-10-261-2/+7
| | | | | d_namlen can never be > NAME_MAX. Stop gcc worrying about this by using a preprocessor test to see if NAME_MAX changes.
* Use the standardized CHAR_BIT constant instead of NBBY in userland.mike2002-09-251-0/+1
|
* Change utimes to set the file creation time (for filesystems thatmckusick2002-07-171-6/+12
| | | | | | | | support creation times such as UFS2) to the value of the modification time if the value of the modification time is older than the current creation time. See utimes(2) for further details. Sponsored by: DARPA & NAI Labs.
* This commit adds basic support for the UFS2 filesystem. The UFS2mckusick2002-06-211-68/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | filesystem expands the inode to 256 bytes to make space for 64-bit block pointers. It also adds a file-creation time field, an ability to use jumbo blocks per inode to allow extent like pointer density, and space for extended attributes (up to twice the filesystem block size worth of attributes, e.g., on a 16K filesystem, there is space for 32K of attributes). UFS2 fully supports and runs existing UFS1 filesystems. New filesystems built using newfs can be built in either UFS1 or UFS2 format using the -O option. In this commit UFS1 is the default format, so if you want to build UFS2 format filesystems, you must specify -O 2. This default will be changed to UFS2 when UFS2 proves itself to be stable. In this commit the boot code for reading UFS2 filesystems is not compiled (see /sys/boot/common/ufsread.c) as there is insufficient space in the boot block. Once the size of the boot block is increased, this code can be defined. Things to note: the definition of SBSIZE has changed to SBLOCKSIZE. The header file <ufs/ufs/dinode.h> must be included before <ufs/ffs/fs.h> so as to get the definitions of ufs2_daddr_t and ufs_lbn_t. Still TODO: Verify that the first level bootstraps work for all the architectures. Convert the utility ffsinfo to understand UFS2 and test growfs. Add support for the extended attribute storage. Update soft updates to ensure integrity of extended attribute storage. Switch the current extended attribute interfaces to use the extended attribute storage. Add the extent like functionality (framework is there, but is currently never used). Sponsored by: DARPA & NAI Labs. Reviewed by: Poul-Henning Kamp <phk@freebsd.org>
* o remove __Pimp2002-03-201-59/+31
| | | | | o Use ANSI function definitions o unifdef -D__STDC__
* Remove 'register' keyword.obrien2002-03-201-18/+18
| | | | | | It does not help modern compilers, and some may take some hit from it. (I also found several functions that listed *every* of its 10 local vars with "register" -- just how many free registers do people think machines have?)
* Respect the -N flag when changing directory attributes in setdirmode).dd2001-08-201-4/+6
| | | | | PR: 29671 Submitted by: Sascha Blank <sblank@addcom.de>
* Honour `TMPDIR' environment variable.sobomax2001-08-131-3/+9
| | | | | | Reviewed by: ru Approved by: ru MFC after: 2 weeks
* Move _PATH_DEFTAPE to <paths.h> to remove all the duplication of definitons,obrien2001-03-081-1/+1
| | | | and remove leading `r'(aw) from it.
* Don't depend on <sys/stat.h> bogusly including <sys/time.h> (and therebywollman2000-10-101-0/+1
| | | | <time.h>).
* Don't try to make files immutable (ie. chflags) before setting access times.dwmalone2000-07-161-1/+1
| | | | | | PR: 19973 Submitted by: Arjan de Vet <Arjan.deVet@adv.iae.nl> Reviewed by: Matthew Jacob <mjacob@feral.com>
* $Id$ -> $FreeBSD$peter1999-08-281-1/+1
|
* 64bit fixes.dima1998-10-271-5/+5
| | | | | | | (Note: ``dump'' doesn't work on alpha yet. Apparently there's a problem somewhere is the physio() area) Submitted by: myself && Matt Dillon.
* Add rcsid. Remove unused #includes. Add missing prototypes and others -Wallcharnier1998-07-281-7/+5
| | | | cleanings. Spelling.
* Fixed printf format errors. Sure is dusty here.bde1998-06-281-2/+2
|
* Many places in the code NULL is used in integer context, wherephk1997-09-181-2/+2
| | | | | | | | | plain 0 should be used. This happens to work because we #define NULL to 0, but is stylistically wrong and can cause problems for people trying to port bits of code to other environments. PR: 2752 Submitted by: Arne Henrik Juul <arnej@imf.unit.no>
* Fprintf -> warn.charnier1997-06-181-8/+5
|
* Merge from Lite2peter1997-03-111-23/+25
| | | | | | | | - cleanups, - whiteout support - bug fixes (chflags missing on a few file types etc) The dump/restore folks would want to have a closer look at this, the change is pretty big.
* Various security related deltas from OpenBSDimp1997-01-011-15/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | dirs.c: From OpenBSD 1.2, 1.3, 1.5, 1.8, 1.10, 1.11, 1.12 1.2: use unique temporary files; netbsd pr#2544; lukem@supp.cpr.itg.telecom.com.au 1.3: updated patch from lukem@supp.cpr.itg.telecom.com.au to also make -r and -R work again 1.5: mktemp open & fdopen 1.8: /tmp// -> /tmp/ 1.10: Fix strncpy usage and correct strncat length field, from Theo. Also change some occurrence of MAXPATHLEN with sizeof(foo). 1.11: does noone know how to use strncat correctly? 1.12: use mkstemp() From NetBSD: Use open rather than create so we can specify exclusive open mode. main.c: From OpenBSD 1.2, 1.5 1.2: From NetBSD: support $TAPE. 1.5 Set umask to be read only by owner until we set real file permissions. tape.c: From NetBSD: Use open rather than create so we can specify exclusive open mode.
* ts_sec -> tv_secnate1996-09-201-4/+4
| | | | ts_nsec -> tv_nsec
* Don't use __dead or __pure in user code. They were obfuscationsbde1996-09-141-1/+1
| | | | | | for gcc >= 2.5 and no-ops for gcc >= 2.6. Converted to use __dead2 or __pure2 where it wasn't already done, except in math.h where use of __pure was mostly wrong.
* Check a pointer in skipdirs() before dereferencing it. I don't fullyjoerg1995-09-011-1/+1
| | | | | | | | | | understand why it can become a null pointer under some circumstances, but i've got a pile of tapes where this happens, and running it thru a debugger proved that simply ending the loop in this case did the right thing. Anyway, it cannot make it worse than now, where restore kills itself with "Memory fault".
* Remove trailing whitespace.rgrimes1995-05-301-3/+3
|
* Fix endian bug introduced at Berkeley during the Net2->4.4-lite transition.pst1994-09-081-8/+12
| | | | | | Fix is courtesy of the NetBSD folks. Reviewed by: pst
* BSD 4.4 Lite sbin Sourcesrgrimes1994-05-261-0/+747
Note: XNSrouted and routed NOT imported here, they shall be imported with usr.sbin.
OpenPOWER on IntegriCloud