--- cvs-1.11.23/diff/diff.c +++ cvs-1.11.23/diff/diff.c @@ -250,6 +250,15 @@ diff_run (argc, argv, out, callbacks_arg) int optind_old; int opened_file = 0; + /* This actually makes a difference for optind_old and opened_file, + * the rest are just to avoid possible compiler warnings. */ + (void) &c; + (void) &prev; + (void) &width; + (void) &show_c_function; + (void) &optind_old; + (void) &opened_file; + callbacks = callbacks_arg; /* Do our initializations. */ --- cvs-1.11.23/diff/diff3.c +++ cvs-1.11.23/diff/diff3.c @@ -209,7 +209,11 @@ static struct diff3_block *reverse_diff3_blocklist PARAMS((struct diff3_block *) static struct diff3_block *using_to_diff3_block PARAMS((struct diff_block *[2], struct diff_block *[2], int, int, struct diff3_block const *)); static struct diff_block *process_diff PARAMS((char const *, char const *, struct diff_block **, char **)); static void check_output PARAMS((FILE *)); -static void diff3_fatal PARAMS((char const *)); +static void diff3_fatal PARAMS((char const *)) +#ifdef __GNUC__ +__attribute__ ((noreturn)) +#endif + ; static void output_diff3 PARAMS((struct diff3_block *, int const[3], int const[3])); static void diff3_perror_with_exit PARAMS((char const *)); static int try_help PARAMS((char const *)); @@ -273,6 +277,10 @@ diff3_run (argc, argv, out, callbacks_arg) int optind_old; int opened_file = 0; + /* Here we don't care if this or another variable is clobbered by the + * setjmp()/longjmp(), so this is just to avoid a warning with gcc. */ + (void) &opened_file; + callbacks = callbacks_arg; initialize_main (&argc, &argv); @@ -1450,6 +1458,10 @@ output_diff3 (diff, mapping, rev_mapping) static int skew_increment[3] = { 2, 3, 1 }; /* 0==>2==>1==>3 */ char const *line_prefix = tab_align_flag ? "\t" : " "; + /* never used */ + oddoneout = 0; + dontprint = 0; + for (ptr = diff; ptr; ptr = D_NEXT (ptr)) { char x[2]; @@ -1558,10 +1570,12 @@ undotlines (leading_dot, start, num) { write_output (".\n", 2); if (leading_dot) - if (num == 1) - printf_output ("%ds/^\\.//\n", start); - else - printf_output ("%d,%ds/^\\.//\n", start, start + num - 1); + { + if (num == 1) + printf_output ("%ds/^\\.//\n", start); + else + printf_output ("%d,%ds/^\\.//\n", start, start + num - 1); + } } /* @@ -1753,10 +1767,12 @@ output_diff3_merge (infile, diff, mapping, rev_mapping, { c = getc (infile); if (c == EOF) - if (ferror (infile)) - diff3_perror_with_exit ("input file"); - else if (feof (infile)) - diff3_fatal ("input file shrank"); + { + if (ferror (infile)) + diff3_perror_with_exit ("input file"); + else if (feof (infile)) + diff3_fatal ("input file shrank"); + } cc = c; write_output (&cc, 1); } @@ -1807,14 +1823,16 @@ output_diff3_merge (infile, diff, mapping, rev_mapping, while (0 <= --i) while ((c = getc (infile)) != '\n') if (c == EOF) - if (ferror (infile)) - diff3_perror_with_exit ("input file"); - else if (feof (infile)) - { - if (i || b->next) - diff3_fatal ("input file shrank"); - return conflicts_found; - } + { + if (ferror (infile)) + diff3_perror_with_exit ("input file"); + else if (feof (infile)) + { + if (i || b->next) + diff3_fatal ("input file shrank"); + return conflicts_found; + } + } } /* Copy rest of common file. */ while ((c = getc (infile)) != EOF || !(ferror (infile) | feof (infile))) --- cvs-1.11.23/diff/side.c +++ cvs-1.11.23/diff/side.c @@ -123,16 +123,18 @@ print_half_line (line, indent, out_bound) case '\b': if (in_position != 0 && --in_position < out_bound) - if (out_position <= in_position) - /* Add spaces to make up for suppressed tab past out_bound. */ - for (; out_position < in_position; out_position++) - write_output (" ", 1); - else - { - out_position = in_position; - cc = c; - write_output (&cc, 1); - } + { + if (out_position <= in_position) + /* Add spaces to make up for suppressed tab past out_bound. */ + for (; out_position < in_position; out_position++) + write_output (" ", 1); + else + { + out_position = in_position; + cc = c; + write_output (&cc, 1); + } + } break; case '\f': --- cvs-1.11.23/diff/util.c +++ cvs-1.11.23/diff/util.c @@ -231,7 +231,7 @@ begin_output () close (pipes[0]); } - execl (PR_PROGRAM, PR_PROGRAM, "-f", "-h", name, 0); + execl (PR_PROGRAM, PR_PROGRAM, "-f", "-h", name, NULL); pfatal_with_name (PR_PROGRAM); } else --- cvs-1.11.23/lib/getline.c +++ cvs-1.11.23/lib/getline.c @@ -154,7 +154,7 @@ getstr (lineptr, n, stream, terminator, offset, limit) return ret; } -int +ssize_t getline (lineptr, n, stream) char **lineptr; size_t *n; --- cvs-1.11.23/lib/getline.h +++ cvs-1.11.23/lib/getline.h @@ -11,7 +11,7 @@ #define GETLINE_NO_LIMIT -1 -int +ssize_t getline __PROTO ((char **_lineptr, size_t *_n, FILE *_stream)); int getline_safe __PROTO ((char **_lineptr, size_t *_n, FILE *_stream, --- cvs-1.11.23/src/buffer.c +++ cvs-1.11.23/src/buffer.c @@ -1864,6 +1864,8 @@ packetizing_buffer_output (closure, data, have, wrote) char *outbuf; int size, status, translated; + outdata = NULL; /* never used */ + if (have > BUFFER_DATA_SIZE) { /* It would be easy to xmalloc a buffer, but I don't think this --- cvs-1.11.23/src/client.c +++ cvs-1.11.23/src/client.c @@ -257,7 +257,7 @@ arg_should_not_be_sent_to_server (arg) /* Since we didn't find it in the list, check the CVSADM files on disk. */ this_root = Name_Root (arg, (char *) NULL); - root_string = this_root->original; + root_string = this_root ? this_root->original : NULL; *t = c; } else @@ -269,7 +269,7 @@ arg_should_not_be_sent_to_server (arg) else { this_root = Name_Root ((char *) NULL, (char *) NULL); - root_string = this_root->original; + root_string = this_root ? this_root->original : NULL; } } @@ -3852,6 +3852,8 @@ auth_server (root, lto_server, lfrom_server, verify_only, do_gssapi, hostinfo) char *username = ""; /* the username we use to connect */ char no_passwd = 0; /* gets set if no password found */ + username = "NONE"; + /* FIXME!!!!!!!!!!!!!!!!!! * * THIS IS REALLY UGLY! @@ -4915,7 +4917,7 @@ send_modified (file, short_pathname, vers) /* File was modified, send it. */ struct stat sb; int fd; - char *buf; + unsigned char *buf; char *mode_string; size_t bufsize; int bin; @@ -4972,7 +4974,7 @@ send_modified (file, short_pathname, vers) { size_t newsize = 0; - if (read_and_gzip (fd, short_pathname, (unsigned char **)&buf, + if (read_and_gzip (fd, short_pathname, &buf, &bufsize, &newsize, file_gzip_level)) error (1, 0, "aborting due to compression error"); @@ -4999,7 +5001,7 @@ send_modified (file, short_pathname, vers) int newsize; { - char *bufp = buf; + unsigned char *bufp = buf; int len; /* FIXME: This is gross. It assumes that we might read --- cvs-1.11.23/src/cvsrc.c +++ cvs-1.11.23/src/cvsrc.c @@ -40,7 +40,7 @@ read_cvsrc (argc, argv, cmdname) FILE *cvsrcfile; char *line; - int line_length; + ssize_t line_length; size_t line_chars_allocated; char *optstart; --- cvs-1.11.23/src/entries.c +++ cvs-1.11.23/src/entries.c @@ -306,7 +306,7 @@ fgetentent(fpin, cmd, sawdir) enum ent_type type; char *l, *user, *vn, *ts, *options; char *tag_or_date, *tag, *date, *ts_conflict; - int line_length; + ssize_t line_length; line = NULL; line_chars_allocated = 0; @@ -742,7 +742,7 @@ ParseTag (tagp, datep, nonbranchp) if (fp) { char *line; - int line_length; + ssize_t line_length; size_t line_chars_allocated; line = NULL; --- cvs-1.11.23/src/fileattr.c +++ cvs-1.11.23/src/fileattr.c @@ -100,7 +100,7 @@ fileattr_read () } attrlist = getlist (); while (1) { - int nread; + ssize_t nread; nread = getline (&line, &line_len, fp); if (nread < 0) break; --- cvs-1.11.23/src/lock.c +++ cvs-1.11.23/src/lock.c @@ -176,8 +176,7 @@ lock_name (repository, name) const char *p; char *q; const char *short_repos; - mode_t save_umask = 0; - int saved_umask = 0; + int saved_umask = -1; if (lock_dir == NULL) { @@ -250,8 +249,7 @@ lock_name (repository, name) if (CVS_STAT (lock_dir, &sb) < 0) error (1, errno, "cannot stat %s", lock_dir); new_mode = sb.st_mode; - save_umask = umask (0000); - saved_umask = 1; + saved_umask = umask (0002); p = short_repos; while (1) @@ -291,11 +289,8 @@ lock_name (repository, name) strcat (retval, "/"); strcat (retval, name); - if (saved_umask) - { - assert (umask (save_umask) == 0000); - saved_umask = 0; - } + if (saved_umask >= 0) + assert (umask (saved_umask) == 0002); } return retval; } --- cvs-1.11.23/src/login.c +++ cvs-1.11.23/src/login.c @@ -289,7 +289,7 @@ password_entry_operation (operation, root, newpassword) FILE *fp; char *cvsroot_canonical = NULL; char *password = NULL; - int line_length; + ssize_t line_length; long line = -1; char *linebuf = NULL; size_t linebuf_len; --- cvs-1.11.23/src/logmsg.c +++ cvs-1.11.23/src/logmsg.c @@ -195,7 +195,7 @@ do_editor (dir, messagep, repository, changes) { static int reuse_log_message = 0; char *line; - int line_length; + ssize_t line_length; size_t line_chars_allocated; char *fname; struct stat pre_stbuf, post_stbuf; @@ -506,7 +506,7 @@ do_verify (messagep, repository) else { char *line = NULL; - int line_length; + ssize_t line_length; size_t line_chars_allocated = 0; char *p; --- cvs-1.11.23/src/patch.c +++ cvs-1.11.23/src/patch.c @@ -388,7 +388,7 @@ patch_fileproc (callerdat, finfo) struct file_info *finfo; { struct utimbuf t; - char *vers_tag, *vers_head; + char *vers_tag = NULL, *vers_head = NULL; char *rcs = NULL; char *rcs_orig = NULL; RCSNode *rcsfile; @@ -404,7 +404,7 @@ patch_fileproc (callerdat, finfo) size_t line2_chars_allocated; char *cp1, *cp2; FILE *fp; - int line_length; + ssize_t line_length; int dargc = 0; size_t darg_allocated = 0; char **dargv = NULL; --- cvs-1.11.23/src/release.c +++ cvs-1.11.23/src/release.c @@ -192,7 +192,8 @@ release (argc, argv) if (!really_quiet) { - int line_length, status; + ssize_t line_length; + int status; /* The "release" command piggybacks on "update", which does the real work of finding out if anything is not --- cvs-1.11.23/src/root.c +++ cvs-1.11.23/src/root.c @@ -41,7 +41,7 @@ Name_Root (dir, update_dir) char *tmp; char *cvsadm; char *cp; - int len; + ssize_t len; if (update_dir && *update_dir) xupdate_dir = update_dir; --- cvs-1.11.23/src/run.c +++ cvs-1.11.23/src/run.c @@ -138,6 +138,14 @@ run_exec (stin, stout, sterr, flags) #endif #endif + /* Avoid warnings about vfork() possibly clobbering these. In reality, + * they aren't modified by the child and thus can't be clobbered. */ + (void) &shin; + (void) &shout; + (void) &sherr; + (void) &rc; + (void) &rerrno; + if (trace) { #ifdef SERVER_SUPPORT --- cvs-1.11.23/src/server.c +++ cvs-1.11.23/src/server.c @@ -2567,7 +2567,7 @@ check_command_legal_p (cmd_name) */ char *linebuf = NULL; - int num_red = 0; + ssize_t num_red = 0; size_t linebuf_len = 0; char *fname; size_t flen; --- cvs-1.11.23/src/update.c +++ cvs-1.11.23/src/update.c @@ -1223,7 +1223,7 @@ checkout_file (finfo, vers_ts, adding, merging, update_server) { char *backup; int set_time, retval = 0; - int status; + int status = 1; int file_is_dead; struct buffer *revbuf; @@ -2276,7 +2276,7 @@ join_file (finfo, vers) || /* destination branch modified in repository */ strcmp (rev1, vers->vn_user) || /* locally modified */ - vers->ts_user && strcmp (vers->ts_user, vers->ts_rcs)) + (vers->ts_user && strcmp (vers->ts_user, vers->ts_rcs))) { /* The removal should happen if either the file has never changed * on the destination or the file has changed to be identical to