Print this page
6659 nvlist_free(NULL) is a no-op


3015         if (wrote != sz) {
3016                 bam_error(WRITE_FAIL, path, strerror(errno));
3017                 (void) close(fd);
3018                 free(nstat);
3019                 return;
3020         }
3021         (void) close(fd);
3022         free(nstat);
3023 
3024         (void) snprintf(path2, sizeof (path2), "%s%s", root, FILE_STAT);
3025         if (rename(path, path2) != 0) {
3026                 bam_error(RENAME_FAIL, path2, strerror(errno));
3027         }
3028 }
3029 
3030 #define init_walk_args()        bzero(&walk_arg, sizeof (walk_arg))
3031 
3032 static void
3033 clear_walk_args(void)
3034 {
3035         if (walk_arg.old_nvlp)
3036                 nvlist_free(walk_arg.old_nvlp);
3037         if (walk_arg.new_nvlp)
3038                 nvlist_free(walk_arg.new_nvlp);
3039         if (walk_arg.sparcfile)
3040                 (void) fclose(walk_arg.sparcfile);
3041         walk_arg.old_nvlp = NULL;
3042         walk_arg.new_nvlp = NULL;
3043         walk_arg.sparcfile = NULL;
3044 }
3045 
3046 /*
3047  * Returns:
3048  *      0 - no update necessary
3049  *      1 - update required.
3050  *      BAM_ERROR (-1) - An error occurred
3051  *
3052  * Special handling for check (-n):
3053  * ================================
3054  * The check (-n) option produces parseable output.
3055  * To do this, we suppress all stdout messages unrelated
3056  * to out of sync files.
3057  * All stderr messages are still printed though.




3015         if (wrote != sz) {
3016                 bam_error(WRITE_FAIL, path, strerror(errno));
3017                 (void) close(fd);
3018                 free(nstat);
3019                 return;
3020         }
3021         (void) close(fd);
3022         free(nstat);
3023 
3024         (void) snprintf(path2, sizeof (path2), "%s%s", root, FILE_STAT);
3025         if (rename(path, path2) != 0) {
3026                 bam_error(RENAME_FAIL, path2, strerror(errno));
3027         }
3028 }
3029 
3030 #define init_walk_args()        bzero(&walk_arg, sizeof (walk_arg))
3031 
3032 static void
3033 clear_walk_args(void)
3034 {

3035         nvlist_free(walk_arg.old_nvlp);

3036         nvlist_free(walk_arg.new_nvlp);
3037         if (walk_arg.sparcfile)
3038                 (void) fclose(walk_arg.sparcfile);
3039         walk_arg.old_nvlp = NULL;
3040         walk_arg.new_nvlp = NULL;
3041         walk_arg.sparcfile = NULL;
3042 }
3043 
3044 /*
3045  * Returns:
3046  *      0 - no update necessary
3047  *      1 - update required.
3048  *      BAM_ERROR (-1) - An error occurred
3049  *
3050  * Special handling for check (-n):
3051  * ================================
3052  * The check (-n) option produces parseable output.
3053  * To do this, we suppress all stdout messages unrelated
3054  * to out of sync files.
3055  * All stderr messages are still printed though.