summaryrefslogtreecommitdiff
path: root/sponge.c
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-09-13 16:36:55 -0400
committerJoey Hess <joey@kitenet.net>2010-09-13 16:36:55 -0400
commit6d1ac81ec62f257ea17b9548ad539b64c743124a (patch)
treee39624487a9654bc2529127df1d9fa876e807c00 /sponge.c
parent32b1e7134b8f07cd3e16d4e3dc7414cbf1305e07 (diff)
downloadmoreutils-6d1ac81ec62f257ea17b9548ad539b64c743124a.tar.gz
minor
Diffstat (limited to 'sponge.c')
-rw-r--r--sponge.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sponge.c b/sponge.c
index dbfc07b..62b3ab5 100644
--- a/sponge.c
+++ b/sponge.c
@@ -72,7 +72,7 @@ static void cs_leave (struct cs_status status) {
}
}
-static void cleanup() {
+static void cleanup () {
if (tmpname) {
unlink(tmpname);
}
@@ -190,7 +190,7 @@ static void write_buff_tmp(char* buff, size_t length, FILE *fd) {
}
}
-static void write_buff_tmp_finish(char* buff, size_t length, FILE *fd) {
+static void write_buff_tmp_finish (char* buff, size_t length, FILE *fd) {
if (length)
write_buff_tmp(buff, length, fd);
if (fflush(fd) != 0) {
@@ -199,7 +199,7 @@ static void write_buff_tmp_finish(char* buff, size_t length, FILE *fd) {
}
}
-static void write_buff_out(char* buff, size_t length, FILE *fd) {
+static void write_buff_out (char* buff, size_t length, FILE *fd) {
if (fwrite(buff, length, 1, fd) < 1) {
perror("error writing buffer to output file");
fclose(fd);
@@ -207,7 +207,7 @@ static void write_buff_out(char* buff, size_t length, FILE *fd) {
}
}
-static void copy_tmpfile(FILE *tmpfile, FILE *outfile, char *buf, size_t size) {
+static void copy_tmpfile (FILE *tmpfile, FILE *outfile, char *buf, size_t size) {
ssize_t i;
if (lseek(fileno(tmpfile), 0, SEEK_SET)) {
perror("could to seek to start of temporary file");
@@ -226,7 +226,7 @@ static void copy_tmpfile(FILE *tmpfile, FILE *outfile, char *buf, size_t size) {
fclose(outfile);
}
-FILE *open_tmpfile(void) {
+FILE *open_tmpfile (void) {
struct cs_status cs;
int tmpfd;
FILE *tmpfile;
@@ -311,11 +311,11 @@ int main (int argc, char **argv) {
}
if (outname) {
- write_buff_tmp_finish(bufstart, bufused, tmpfile);
-
mode_t mode;
struct stat statbuf;
int exists = (lstat(outname, &statbuf) == 0);
+
+ write_buff_tmp_finish(bufstart, bufused, tmpfile);
/* Set temp file mode to match either
* the old file mode, or the default file