[PATCH] mkfs.ubifs: eliminate compiler warnings
Mike Frysinger
vapier.adi at gmail.com
Thu Feb 12 03:48:47 EST 2009
On Thu, Feb 12, 2009 at 03:53, Adrian Hunter wrote:
> --- a/mkfs.ubifs/mkfs.ubifs.c
> +++ b/mkfs.ubifs/mkfs.ubifs.c
> @@ -248,7 +248,8 @@ static int do_openat(int fd, const char *path, int flags)
> ret = fchdir(fd);
> if (ret != -1)
> ret = open(path, flags);
> - chdir(cwd);
> + if (chdir(cwd) && !ret)
> + ret = -1;
> free(cwd);
> return ret;
> }
does gcc do the right thing and re-order this ? or re-order it
yourself so the intent stays clear ...
> case 'h':
> case '?':
> - printf(helptext);
> + printf("%s", helptext);
> exit(0);
puts() would be less overhead ... just make sure helptext doesnt have
a trailing \n ...
-mike
More information about the linux-mtd
mailing list