search for: s_isreg

Displaying 20 results from an estimated 132 matches for "s_isreg".

Did you mean: s_ifreg
2010 Jun 15
3
about rsyncing of block devices
...n int copy_devices; extern int preserve_specials; extern int preserve_hard_links; extern int preserve_executability; @@ -980,7 +981,7 @@ static int try_dests_reg(struct file_str do { pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname); - if (link_stat(cmpbuf, &sxp->st, 0) < 0 || !S_ISREG(sxp->st.st_mode)) + if (link_stat(cmpbuf, &sxp->st, 0) < 0 || !(S_ISREG(sxp->st.st_mode) || (copy_devices && IS_DEVICE(sxp->st.st_mode)))) continue; switch (match_level) { case 0: @@ -1695,7 +1696,7 @@ static void recv_generator(char *fname, goto cleanup;...
2009 Oct 15
1
PATCH: --write-devices to allow synchronising to a block device
...preserve_links; extern int preserve_devices; +extern int write_devices; extern int preserve_specials; extern int preserve_hard_links; extern int preserve_executability; @@ -1733,7 +1734,7 @@ fnamecmp = fname; fnamecmp_type = FNAMECMP_FNAME; - if (statret == 0 && !S_ISREG(sx.st.st_mode)) { + if (statret == 0 && !(S_ISREG(sx.st.st_mode) || (write_devices && IS_DEVICE(sx.st.st_mode)))) { if (delete_item(fname, sx.st.st_mode, del_opts | DEL_FOR_FILE) != 0) goto cleanup; statret = -1; diff -ru...
2016 Jun 14
1
[PATCH supermin] init: Delete initramfs files before chrooting into the appliance.
...chdir ("/") == -1) { + perror ("chdir: /"); + return; + } + + dir = opendir ("."); + if (!dir) { + perror ("opendir: /"); + return; + } + + while ((d = readdir (dir)) != NULL) { + /* "." and ".." are directories, so the S_ISREG test ignores them. */ + if (lstat (d->d_name, &statbuf) >= 0 && S_ISREG (statbuf.st_mode)) { + if (unlink (d->d_name) == -1) + perror (d->d_name); + } + } + + closedir (dir); +} + /* Display a directory on stderr. This is used for debugging only. */ st...
2019 Jan 25
0
[klibc:update-dash] redir: Fix typo in noclobber code
...ben at decadent.org.uk> --- usr/dash/redir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/redir.c b/usr/dash/redir.c index f96a76bc..71b0f774 100644 --- a/usr/dash/redir.c +++ b/usr/dash/redir.c @@ -192,7 +192,7 @@ openredirect(union node *redir) } else if (!S_ISREG(sb.st_mode)) { if ((f = open64(fname, O_WRONLY, 0666)) < 0) goto ecreate; - if (fstat64(f, &sb) < 0 && S_ISREG(sb.st_mode)) { + if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) { close(f); errno = EEXIST; goto ecreate;
2020 Mar 28
0
[klibc:update-dash] dash: redir: Fix typo in noclobber code
...ben at decadent.org.uk> --- usr/dash/redir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr/dash/redir.c b/usr/dash/redir.c index f96a76bc..71b0f774 100644 --- a/usr/dash/redir.c +++ b/usr/dash/redir.c @@ -192,7 +192,7 @@ openredirect(union node *redir) } else if (!S_ISREG(sb.st_mode)) { if ((f = open64(fname, O_WRONLY, 0666)) < 0) goto ecreate; - if (fstat64(f, &sb) < 0 && S_ISREG(sb.st_mode)) { + if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) { close(f); errno = EEXIST; goto ecreate;
2002 Jan 13
1
rsynd-2.5.1 / hlink.c patches
...+++ lcl_src:hlink.c_unix Sat Jan 12 19:28:00 2002 @@ -23,7 +23,8 @@ extern int verbose; #if SUPPORT_HARD_LINKS -static int hlink_compare(struct file_struct *f1,struct file_struct *f2) +static int hlink_compare + (const struct file_struct *f1, const struct file_struct *f2) { if (!S_ISREG(f1->mode) && !S_ISREG(f2->mode)) return 0; if (!S_ISREG(f1->mode)) return -1; @@ -60,7 +61,7 @@ qsort(hlink_list,flist->count, sizeof(hlink_list[0]), - (int (*)())hlink_compare); + (hlink_compare); hlink_count=flist-...
1999 Feb 10
1
When a shell says no (clobber) it means maybe.
.../tmp/predicted p cat /tmp/predicted > $stolen cat $switched > /tmp/predicted ) & 2) They will clobber symlinks. ln -s /some/new/target /tmp/predicted 3) They can be raced. mkdir /tmp/predicted echo "hoping stat() happens now: returns 0 and non S_ISREG" mv /tmp/predicted /tmp/other ln -s /some/old/target /tmp/predicted Is there some reason (such as standards or a situation I've overlooked) why they should do this and not say noclobber => O_EXCL, end of story ? exec.c from pdksh-5.2.12 1293 case IOWRITE: 1294 f...
2014 May 22
0
[PATCH] openssh - loginrec.c - Non-atomic file operations.
...t(LASTLOG_FILE, &st) != 0) { - logit("%s: Couldn't stat %s: %s", __func__, - LASTLOG_FILE, strerror(errno)); - return (0); - } - if (S_ISDIR(st.st_mode)) { - snprintf(lastlog_file, sizeof(lastlog_file), "%s/%s", - LASTLOG_FILE, li->username); - } else if (S_ISREG(st.st_mode)) { + DIR *lastlog_dir; + int dir_fd = -1; + + /* Try to open directory */ + lastlog_dir = opendir(lastlog_file); + if (lastlog_dir != NULL) { + /* So. We are directory. */ + dir_fd = dirfd(lastlog_dir); + snprintf(lastlog_file, sizeof(lastlog_file), "/dev/fd/%d/%s", + dir...
2014 Mar 10
5
[Bug 10494] New: remove-source-files fails with symlinks
https://bugzilla.samba.org/show_bug.cgi?id=10494 Summary: remove-source-files fails with symlinks Product: rsync Version: 3.1.0 Platform: x64 OS/Version: Linux Status: NEW Severity: major Priority: P5 Component: core AssignedTo: wayned at samba.org ReportedBy: afried at deteque.com
2005 Jan 05
1
rsync filename heuristics
...gt; +extern int verbose; > + > +/* Alternate methods for opening files, if local doesn't exist */ > +/* Sanity check that we are about to open regular file */ > +int do_open_regular(char *fname) > +{ > + STRUCT_STAT st; > + > + if (do_stat(fname, &st) == 0 && S_ISREG(st.st_mode)) > + return do_open(fname, O_RDONLY, 0); > + > + return -1; > +} > + > +static void split_names(char *fname, char **dirname, char **basename) > +{ > + char *slash; > + > + slash = strrchr(fname, '/'); > + if (slash) { > + *dirname = fname; &...
2009 Nov 25
0
[LLVMdev] [llvm-commits] [llvm] r89765 - in /llvm/trunk: include/llvm/System/Path.h lib/System/Unix/Path.inc lib/System/Win32/Path.inc
....org/viewvc/llvm-project?view=rev&revision=89849 Thanks everyone for the feedback, Edward. 2009/11/24 Edward O'Callaghan <eocallaghan at auroraux.org>: > G'Day Daniel, > >> I would prefer this be Path::isRegularFile, that corresponds to a well >> known Unixism (S_ISREG) and avoids creating new terminology. >> Similarly, I don't think it should do anything else -- checking that >> the path is a directory is something clients can do. > > You know that's about the forth time someone has told me to change the name. :| > Also, isRegularFil...
2004 Jan 24
2
[PATCH] --links-depth for rsync
...id make_file_stat(struct file_struct * file, STRUCT_STAT *st) +{ + file->modtime = st->st_mtime; + file->length = st->st_size; + file->mode = st->st_mode; + file->uid = st->st_uid; + file->gid = st->st_gid; + if (preserve_hard_links) { + if (protocol_version < 28 ? S_ISREG(st->st_mode) + : !S_ISDIR(st->st_mode) && st->st_nlink > 1) { + if (!file->link_u.idev) { + if (!(file->link_u.idev = new(struct idev))) + out_of_memory("file inode data"); + } + file->F_DEV = st->st_dev; + file->F_INODE = st->st_i...
2003 Sep 03
1
[patch] replace dir with file error
...================================================= RCS file: /data/cvs/rsync/receiver.c,v retrieving revision 1.51 diff -u -r1.51 receiver.c --- receiver.c 21 Aug 2003 23:45:49 -0000 1.51 +++ receiver.c 2 Sep 2003 23:29:13 -0000 @@ -419,11 +419,23 @@ continue; } - if (fd1 != -1 && !S_ISREG(st.st_mode)) { - rprintf(FERROR,"%s : not a regular file (recv_files)\n",fnamecmp); - receive_data(f_in,NULL,-1,NULL,file->length); + if (fd1 != -1 && S_ISDIR(st.st_mode) && fnamecmp == fname) { + /* this special handling for directories + * wouldn't be ne...
2004 Sep 02
1
--partiall-dir not behaving like it ought too
Hi, I have awaited the new release inorder to use the -"-partial-dir" option. But after testing it seems that it does not behave like it says on the tin. It will correctly move and rename the interrupted file to the declared directory, but it will not attempt to use it when the client attempts to rsync the file again. I have a Solaris 8 box running as a server (Matthew), and another
2019 Jun 21
2
sftp client: upload from pipe
....ssh/key user at remote.host sftp> put /dev/stdin /directory/filename /dev/stdin is not a regular file What is a purpose for such a behaviour and limitation? As experiment, I removed following piece of code which is responsible for this check (sftp-client.c, do_upload() function): if (!S_ISREG(sb.st_mode)) { error("%s is not a regular file", local_path); close(local_fd); return(-1); } and nothing bad happened. It was still possible to upload regular files, but additionaly there was an opportunity for upload data piped fro...
2020 Mar 28
0
[klibc:update-dash] dash: exec: Stricter pathopt parsing
...} else if (!(act & DO_NOFUNC) && - prefix(pathopt, "func")) { + } else if (!(act & DO_NOFUNC)) { /* handled below */ } else { /* ignore unimplemented options */ @@ -397,7 +443,7 @@ loop: e = EACCES; /* if we fail, this will be the error */ if (!S_ISREG(statb.st_mode)) continue; - if (pathopt) { /* this is a %func directory */ + if (lpathopt) { /* this is a %func directory */ stalloc(len); readcmdfile(fullname); if ((cmdp = cmdlookup(name, 0)) == NULL || @@ -515,39 +561,26 @@ hashcd(void) void changepath(const char *newval)...
2006 Mar 21
2
[PATCH] initramfs: CPIO unpacking fix
...1 files changed, 3 insertions(+) Index: linux-2.6.15/init/initramfs.c =================================================================== --- linux-2.6.15.orig/init/initramfs.c +++ linux-2.6.15/init/initramfs.c @@ -249,6 +249,7 @@ static int __init do_name(void) if (dry_run) return 0; if (S_ISREG(mode)) { + sys_unlink(collected); if (maybe_link() >= 0) { wfd = sys_open(collected, O_WRONLY|O_CREAT, mode); if (wfd >= 0) { @@ -263,6 +264,7 @@ static int __init do_name(void) sys_chmod(collected, mode); } else if (S_ISBLK(mode) || S_ISCHR(mode) || S_ISFIFO(mode) || S...
2009 Mar 06
4
rosh patch
...estr2[0] = 0; file2pos = strlen(filestr); @@ -401,7 +400,6 @@ #ifdef DO_DEBUG // inchar = fgetc(stdin); #endif /* DO_DEBUG */ - de = readdir(d); } closedir(d); } else if (S_ISREG(fdstat.st_mode)) { @@ -419,8 +417,7 @@ d = opendir(filestr); if (d != NULL) { printf("DIR:'%s' %8d %8d\n", d->dd_name, d->dd_fd, d->dd_sect); - de = readdir(d); -...
2014 Dec 24
0
[PATCH 1/8] extlinux/main.c: support unmounted ext2/3/4 filesystem
...evname); - if (devfd < 0) - return 1; + /* Support dir, ext2, ext3 and ext4 filesystem (device or file block) */ + if S_ISDIR(st.st_mode) { + devfd = open_device(path, &st, &devname); + if (devfd < 0) + return 1; + } else if (S_ISBLK(st.st_mode) || S_ISREG(st.st_mode)) { + if ((devfd = open(path, O_RDWR | O_SYNC)) < 0) { + fprintf(stderr, "%s: cannot open device %s\n", program, devname); + return -1; + } + } else { + fprintf(stderr, "%s: unsupported file type: %s\n", program, path);...
2004 Apr 15
0
Multiple compare-dest args
...1pre-1-vidar/generator.c 2004-04-15 11:23:17.000000000 +0200 @@ -41,7 +41,7 @@ extern int io_timeout; extern int protocol_version; extern int always_checksum; -extern char *compare_dest; +extern char *compare_dest[]; extern int link_dest; @@ -69,13 +69,13 @@ if (always_checksum && S_ISREG(st->st_mode)) { char sum[MD4_SUM_LENGTH]; char fnamecmpdest[MAXPATHLEN]; + int i = 0; - if (compare_dest != NULL) { - if (access(fname, 0) != 0) { - pathjoin(fnamecmpdest, sizeof fnamecmpdest, - compare_dest, fname); - fname = fnamecmpdest; - } + while ((access(fname, 0...