equal
deleted
inserted
replaced
85 |
85 |
86 |
86 |
87 |
87 |
88 struct pt_ctx *ctx = NULL; |
88 struct pt_ctx *ctx = NULL; |
89 struct pt_image *image = NULL; |
89 struct pt_image *image = NULL; |
90 int stale; |
90 enum pt_cache_status status; |
91 |
91 |
92 log_debug("Processing %d images...", argc - optind); |
92 log_debug("Processing %d images...", argc - optind); |
93 |
93 |
94 for (int i = optind; i < argc; i++) { |
94 for (int i = optind; i < argc; i++) { |
95 const char *img_path = argv[i]; |
95 const char *img_path = argv[i]; |
103 } |
103 } |
104 |
104 |
105 log_info("Opened image at: %s", img_path); |
105 log_info("Opened image at: %s", img_path); |
106 |
106 |
107 // check if stale |
107 // check if stale |
108 if ((stale = pt_image_stale(image)) < 0) { |
108 if ((status = pt_image_status(image)) < 0) { |
109 log_errno("pt_image_stale: %s", img_path); |
109 log_errno("pt_image_status: %s", img_path); |
110 goto error; |
110 goto error; |
111 } |
111 } |
112 |
112 |
113 // update if stale |
113 // update if stale |
114 if (stale || force_update) { |
114 if (status != PT_CACHE_FRESH || force_update) { |
115 if (stale) |
115 if (status == PT_CACHE_NONE) |
116 log_debug("Image cache is stale, updating..."); |
116 log_debug("Image cache is missing"); |
117 else // force_update |
117 |
118 log_debug("Updating image cache..."); |
118 else if (status == PT_CACHE_STALE) |
|
119 log_debug("Image cache is stale"); |
|
120 |
|
121 else if (status == PT_CACHE_FRESH) |
|
122 log_debug("Image cache is fresh"); |
|
123 |
|
124 log_debug("Updating image cache..."); |
119 |
125 |
120 if (pt_image_update(image)) { |
126 if (pt_image_update(image)) { |
121 log_warn_errno("pt_image_update: %s", img_path); |
127 log_warn_errno("pt_image_update: %s", img_path); |
122 } |
128 } |
123 |
129 |